chore: eslint cleanup (#10160)

This commit is contained in:
farfromrefuge
2023-01-09 17:40:20 +00:00
committed by GitHub
parent bff35e5163
commit 0632215793
18 changed files with 97 additions and 71 deletions

View File

@@ -159,11 +159,11 @@ export function debounce(fn: any, delay = 300) {
};
}
export function throttle(fn: any, delay = 300) {
export function throttle(fn: Function, delay = 300) {
let waiting = false;
return function () {
return function (...args) {
if (!waiting) {
fn.apply(this, arguments);
fn.apply(this, args);
waiting = true;
setTimeout(function () {
waiting = false;

View File

@@ -34,9 +34,10 @@ export function dataDeserialize(nativeData?: any) {
}
case 'org.json.JSONObject': {
store = {};
let i = nativeData.keys();
const i = nativeData.keys();
let key;
while (i.hasNext()) {
let key = i.next();
key = i.next();
store[key] = dataDeserialize(nativeData.get(key));
}
break;

View File

@@ -36,8 +36,8 @@ export function dataDeserialize(nativeData?: any) {
case 'NSNull':
return null;
case 'NSMutableDictionary':
case 'NSDictionary':
let obj = {};
case 'NSDictionary': {
const obj = {};
const length = nativeData.count;
const keysArray = nativeData.allKeys as NSArray<any>;
for (let i = 0; i < length; i++) {
@@ -45,14 +45,16 @@ export function dataDeserialize(nativeData?: any) {
obj[nativeKey] = dataDeserialize(nativeData.objectForKey(nativeKey));
}
return obj;
}
case 'NSMutableArray':
case 'NSArray':
let array = [];
case 'NSArray': {
const array = [];
const len = nativeData.count;
for (let i = 0; i < len; i++) {
array[i] = dataDeserialize(nativeData.objectAtIndex(i));
}
return array;
}
default:
return nativeData;
}