@kizmann/pico-js 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,6 +134,7 @@ export class PicoArray {
134
134
  * @returns {any} Mapped array
135
135
  */
136
136
  static each(value: any, cb: Function, retval?: any): any;
137
+ static eachObj(value: any, cb: any, retval?: any): any;
137
138
  /**
138
139
  * Map values in place (mutates)
139
140
  *
@@ -156,6 +157,7 @@ export class PicoArray {
156
157
  * @returns {any} Mapped tree
157
158
  */
158
159
  static recursive(value: any, key: string, cb: Function, cascade?: Array<any>): any;
160
+ static recursiveObj(value: any, key: any, cb: any, cascade?: any[]): any;
159
161
  /**
160
162
  * Get matching indexes by filter
161
163
  *
@@ -166,6 +168,7 @@ export class PicoArray {
166
168
  * @returns {Array<string>} Matching keys
167
169
  */
168
170
  static filterIndex(value: any, filter?: any): Array<string>;
171
+ static filterRemove(value: any, filter?: any): any;
169
172
  /**
170
173
  * Filter values by filter
171
174
  *
@@ -455,26 +458,26 @@ export namespace PicoArray {
455
458
  /**
456
459
  * @see PicoArray.sortPrim
457
460
  */
458
- function sortString(...args: any[]): any;
461
+ function sortString(...args: any[]): any[];
459
462
  /**
460
463
  * @see PicoArray.append
461
464
  */
462
- function push(...args: any[]): any;
465
+ function push(...args: any[]): any[];
463
466
  /**
464
467
  * @see PicoArray.merge
465
468
  */
466
- function concat(...args: any[]): any;
469
+ function concat(...args: any[]): any[];
467
470
  /**
468
471
  * @see PicoArray.matches
469
472
  */
470
- function equal(...args: any[]): any;
473
+ function equal(...args: any[]): boolean;
471
474
  /**
472
475
  * @see PicoArray.diff
473
476
  */
474
- function diffrence(...args: any[]): any;
477
+ function diffrence(...args: any[]): any[];
475
478
  /**
476
479
  * @see PicoArray.isect
477
480
  */
478
- function intersect(...args: any[]): any;
481
+ function intersect(...args: any[]): any[];
479
482
  }
480
483
  export default PicoArray;
@@ -55,4 +55,4 @@ export class PicoEvent {
55
55
  */
56
56
  static unpause(event: any, options?: any): typeof PicoEvent;
57
57
  }
58
- export default PicoEvent;
58
+ export default Event;
@@ -112,4 +112,4 @@ export class PicoLocale {
112
112
  */
113
113
  static countpick(splits: Array<string>, count: number): string;
114
114
  }
115
- export default PicoLocale;
115
+ export default Locale;
@@ -66,7 +66,7 @@ export class PicoMixed {
66
66
  /**
67
67
  * @see PicoMixed.isPrim
68
68
  */
69
- static isPrimitive: typeof PicoMixed.isPrim;
69
+ static isPrimitive: typeof Mix.isPrim;
70
70
  /**
71
71
  * Check if the value is a string
72
72
  *
@@ -80,7 +80,7 @@ export class PicoMixed {
80
80
  /**
81
81
  * @see PicoMixed.isStr
82
82
  */
83
- static isString: typeof PicoMixed.isStr;
83
+ static isString: typeof Mix.isStr;
84
84
  /**
85
85
  * Check if the value is a number
86
86
  *
@@ -95,7 +95,7 @@ export class PicoMixed {
95
95
  /**
96
96
  * @see PicoMixed.isNum
97
97
  */
98
- static isNumber: typeof PicoMixed.isNum;
98
+ static isNumber: typeof Mix.isNum;
99
99
  /**
100
100
  * Check if the value is an integer
101
101
  *
@@ -111,7 +111,7 @@ export class PicoMixed {
111
111
  /**
112
112
  * @see PicoMixed.isInt
113
113
  */
114
- static isInteger: typeof PicoMixed.isInt;
114
+ static isInteger: typeof Mix.isInt;
115
115
  /**
116
116
  * Check if the value is a boolean
117
117
  *
@@ -127,7 +127,7 @@ export class PicoMixed {
127
127
  /**
128
128
  * @see PicoMixed.isBool
129
129
  */
130
- static isBoolean: typeof PicoMixed.isBool;
130
+ static isBoolean: typeof Mix.isBool;
131
131
  /**
132
132
  * Check if the value is a function
133
133
  *
@@ -143,7 +143,7 @@ export class PicoMixed {
143
143
  /**
144
144
  * @see PicoMixed.isFunc
145
145
  */
146
- static isFunction: typeof PicoMixed.isFunc;
146
+ static isFunction: typeof Mix.isFunc;
147
147
  /**
148
148
  * Check if the value is object
149
149
  *
@@ -160,7 +160,7 @@ export class PicoMixed {
160
160
  /**
161
161
  * @see PicoMixed.isRef
162
162
  */
163
- static isReference: typeof PicoMixed.isRef;
163
+ static isReference: typeof Mix.isRef;
164
164
  /**
165
165
  * Check if the value is plain object
166
166
  *
@@ -174,7 +174,7 @@ export class PicoMixed {
174
174
  /**
175
175
  * @see PicoMixed.isObj
176
176
  */
177
- static isObject: typeof PicoMixed.isObj;
177
+ static isObject: typeof Mix.isObj;
178
178
  /**
179
179
  * Check if the value is array object
180
180
  *
@@ -188,7 +188,7 @@ export class PicoMixed {
188
188
  /**
189
189
  * @see PicoMixed.isArr
190
190
  */
191
- static isArray: typeof PicoMixed.isArr;
191
+ static isArray: typeof Mix.isArr;
192
192
  /**
193
193
  * Check if the value is iterable object
194
194
  *
@@ -202,7 +202,7 @@ export class PicoMixed {
202
202
  /**
203
203
  * @see PicoMixed.isIter
204
204
  */
205
- static isIterable: typeof PicoMixed.isIter;
205
+ static isIterable: typeof Mix.isIter;
206
206
  /**
207
207
  * Check if the value is iso date
208
208
  *
@@ -349,7 +349,7 @@ export class PicoMixed {
349
349
  /**
350
350
  * @see PicoMixed.length
351
351
  */
352
- static length: typeof PicoMixed.len;
352
+ static length: typeof Mix.len;
353
353
  /**
354
354
  * Compare two objects (used for natural array sort)
355
355
  *
@@ -380,7 +380,7 @@ export class PicoMixed {
380
380
  /**
381
381
  * @see PicoMixed.arr
382
382
  */
383
- static array: typeof PicoMixed.arr;
383
+ static array: typeof Mix.arr;
384
384
  /**
385
385
  * Convert value to string
386
386
  *
@@ -397,7 +397,7 @@ export class PicoMixed {
397
397
  /**
398
398
  * @see PicoMixed.str
399
399
  */
400
- static string: typeof PicoMixed.str;
400
+ static string: typeof Mix.str;
401
401
  /**
402
402
  * Convert value to number
403
403
  *
@@ -414,7 +414,7 @@ export class PicoMixed {
414
414
  /**
415
415
  * @see PicoMixed.num
416
416
  */
417
- static number: typeof PicoMixed.num;
417
+ static number: typeof Mix.num;
418
418
  /**
419
419
  * Convert value to integer
420
420
  *
@@ -431,7 +431,7 @@ export class PicoMixed {
431
431
  /**
432
432
  * @see PicoMixed.int
433
433
  */
434
- static integer: typeof PicoMixed.int;
434
+ static integer: typeof Mix.int;
435
435
  /**
436
436
  * Convert value to boolean
437
437
  *
@@ -450,14 +450,14 @@ export class PicoMixed {
450
450
  /**
451
451
  * @see PicoMixed.bool
452
452
  */
453
- static boolean: typeof PicoMixed.bool;
453
+ static boolean: typeof Mix.bool;
454
454
  }
455
455
  export namespace PicoMixed {
456
456
  function global(...args: any[]): any;
457
457
  function isPlain(...args: any[]): boolean;
458
458
  function float(...args: any[]): any;
459
459
  function delay(...args: any[]): Function;
460
- function async(...args: any[]): typeof import("./Runner.js").PicoRunner;
460
+ function async(...args: any[]): Function;
461
461
  function debounce(...args: any[]): Function;
462
462
  function throttle(...args: any[]): Function;
463
463
  function framerate(...args: any[]): Function;
@@ -466,4 +466,5 @@ export namespace PicoMixed {
466
466
  function convertBool(...args: any[]): any;
467
467
  function convertBoolean(...args: any[]): any;
468
468
  }
469
- export default PicoMixed;
469
+ export default Mix;
470
+ import { Mix } from "../index.esm.js";
@@ -124,4 +124,4 @@ export namespace PicoNumber {
124
124
  */
125
125
  function random(...args: any[]): number;
126
126
  }
127
- export default PicoNumber;
127
+ export default Num;
@@ -229,6 +229,8 @@ export class PicoObject {
229
229
  * @returns {boolean} True if matches
230
230
  */
231
231
  static matches(value: any, search: any): boolean;
232
+ static sort(obj: any, key: any): any[];
233
+ static sortString(obj: any, key: any): any[];
232
234
  }
233
235
  export namespace PicoObject {
234
236
  /**
@@ -243,13 +245,5 @@ export namespace PicoObject {
243
245
  * @see PicoArray.findIndex
244
246
  */
245
247
  function findIndex(...args: any[]): number;
246
- /**
247
- * @see PicoArray.sort
248
- */
249
- function sort(...args: any[]): any[];
250
- /**
251
- * @see PicoArray.sortDeep
252
- */
253
- function sortString(...args: any[]): any[];
254
248
  }
255
249
  export default PicoObject;
@@ -1,87 +1,73 @@
1
1
  export class PicoRunner {
2
- static $idler: {
3
- native: {};
4
- debounce: {};
5
- throttle: {};
6
- };
7
- static $timer: {
8
- date: number;
9
- func: any;
10
- };
2
+ static $idler: any;
3
+ static $timer: number;
11
4
  static $buffer: any[];
12
5
  /**
13
- * Run callback after delay (id)
6
+ * Clear timer or call function
14
7
  *
15
- * @example Run.timeout(() => {}, 100) // => "t-..."
8
+ * @example Run.clear(timer)
16
9
  *
17
- * @param {function} fn Callback to run
18
- * @param {number} [delay] Delay ms
19
- * @param {string|null} [index] Timer id
20
- * @returns {string} Timer id
10
+ * @param {any} timer Timer ID, array of IDs, or function
11
+ * @returns {typeof PicoRunner} Static class
21
12
  */
22
- static timeout(fn: Function, delay?: number, index?: string | null): string;
13
+ static clear(timer: any): typeof PicoRunner;
23
14
  /**
24
- * Run callback on interval (id)
25
- *
26
- * @example Run.interval(() => {}, 250) // => "i-..."
15
+ * Request idle callback with fallback
27
16
  *
28
- * @param {function} fn Callback to run
29
- * @param {number} [intval] Interval ms
30
- * @param {string|null} [index] Timer id
31
- * @returns {string} Timer id
17
+ * @param {function} cb Callback function
18
+ * @returns {typeof PicoRunner} Static class
32
19
  */
33
- static interval(fn: Function, intval?: number, index?: string | null): string;
20
+ static tryin(cb: Function): typeof PicoRunner;
34
21
  /**
35
- * Clear timer(s) by id
22
+ * Wait for condition to be true
36
23
  *
37
- * @example Run.clear("i-abc") // => Run
38
- * @example Run.clear(["t-a","i-b"]) // => Run
24
+ * @example Run.wait(() => window.foo, 10, 100)
39
25
  *
40
- * @param {string|Array<string>} index Timer id(s)
41
- * @param {string} [scope] Idler scope key
42
- * @returns {typeof PicoRunner} Runner class
26
+ * @param {function} fn Condition function
27
+ * @param {number} [intval] Interval ms
28
+ * @param {number} [limit] Max iterations
29
+ * @returns {function} Clear function
43
30
  */
44
- static clear(index: string | Array<string>, scope?: string): typeof PicoRunner;
31
+ static wait(fn: Function, intval?: number, limit?: number): Function;
45
32
  /**
46
- * Poll until callback is true
33
+ * Run function in next animation frame
47
34
  *
48
- * @example Run.wait(() => ready, 50) // polls
35
+ * @example Run.frame(cb)
49
36
  *
50
- * @param {function} fn Condition callback
51
- * @param {number} [intval] Poll interval ms
52
- * @param {number} [limit] Max poll count
53
- * @returns {void} No return value
37
+ * @param {function} fn Callback function
38
+ * @param {any} [...args] Callback arguments
39
+ * @returns {function} Noop clear function
54
40
  */
55
- static wait(fn: Function, intval?: number, limit?: number): void;
41
+ static frame(fn: Function, ...args: any[]): Function;
56
42
  /**
57
- * Run callback in next frame
43
+ * Run function when browser is idle
58
44
  *
59
- * @example Run.frame(() => {}) // => Run
45
+ * @example Run.idle(cb)
60
46
  *
61
- * @param {function} fn Callback to run
62
- * @param {...any} args Callback args
63
- * @returns {typeof PicoRunner} Runner class
47
+ * @param {function} fn Callback function
48
+ * @param {any} [...args] Callback arguments
49
+ * @returns {function} Noop clear function
64
50
  */
65
- static frame(fn: Function, ...args: any[]): typeof PicoRunner;
51
+ static idle(fn: Function, ...args: any[]): Function;
66
52
  /**
67
- * Run callback async soon
53
+ * Run function asynchronously
68
54
  *
69
- * @example Run.async(() => {}) // => Run
55
+ * @example Run.async(cb)
70
56
  *
71
- * @param {function} fn Callback to run
72
- * @param {...any} args Callback args
73
- * @returns {typeof PicoRunner} Runner class
57
+ * @param {function} fn Callback function
58
+ * @param {any} [...args] Callback arguments
59
+ * @returns {function} Noop clear function
74
60
  */
75
- static async(fn: Function, ...args: any[]): typeof PicoRunner;
61
+ static async(fn: Function, ...args: any[]): Function;
76
62
  /**
77
- * Run callback after delay
63
+ * Run function after delay
78
64
  *
79
- * @example const cancel = Run.delay(() => {}, 50)
65
+ * @example Run.delay(cb, 100)
80
66
  *
81
- * @param {function} fn Callback to run
67
+ * @param {function} fn Callback function
82
68
  * @param {number} [delay] Delay ms
83
- * @param {...any} args Callback args
84
- * @returns {function} Cancel function
69
+ * @param {any} [...args] Callback arguments
70
+ * @returns {function} Clear function
85
71
  */
86
72
  static delay(fn: Function, delay?: number, ...args: any[]): Function;
87
73
  /**
@@ -91,10 +77,9 @@ export class PicoRunner {
91
77
  *
92
78
  * @param {function} cb Callback to run
93
79
  * @param {number} [timeout] Wait ms
94
- * @param {string|null} [index] Debounce id
95
80
  * @returns {function} Debounced fn
96
81
  */
97
- static debounce(cb: Function, timeout?: number, index?: string | null): Function;
82
+ static debounce(cb: Function, timeout?: number): Function;
98
83
  /**
99
84
  * Create throttled callback
100
85
  *
@@ -102,10 +87,9 @@ export class PicoRunner {
102
87
  *
103
88
  * @param {function} cb Callback to run
104
89
  * @param {number} [timeout] Wait ms
105
- * @param {string|null} [index] Throttle id
106
90
  * @returns {function} Throttled fn
107
91
  */
108
- static throttle(cb: Function, timeout?: number, index?: string | null): Function;
92
+ static throttle(cb: Function, timeout?: number): Function;
109
93
  /**
110
94
  * Create framerate-limited callback
111
95
  *
@@ -74,7 +74,7 @@ export class PicoString {
74
74
  /**
75
75
  * @see PicoString.uc
76
76
  */
77
- static upper: typeof PicoString.uc;
77
+ static upper: typeof Str.uc;
78
78
  /**
79
79
  * Uppercase first character
80
80
  *
@@ -96,7 +96,7 @@ export class PicoString {
96
96
  /**
97
97
  * @see PicoString.lc
98
98
  */
99
- static lower: typeof PicoString.lc;
99
+ static lower: typeof Str.lc;
100
100
  /**
101
101
  * Lowercase first character
102
102
  *
@@ -118,7 +118,7 @@ export class PicoString {
118
118
  /**
119
119
  * @see PicoString.cc
120
120
  */
121
- static camelcase: typeof PicoString.cc;
121
+ static camelcase: typeof Str.cc;
122
122
  /**
123
123
  * Convert to kebab-case
124
124
  *
@@ -131,7 +131,7 @@ export class PicoString {
131
131
  /**
132
132
  * @see PicoString.kc
133
133
  */
134
- static kebabcase: typeof PicoString.kc;
134
+ static kebabcase: typeof Str.kc;
135
135
  /**
136
136
  * Convert to snake_case
137
137
  *
@@ -144,7 +144,7 @@ export class PicoString {
144
144
  /**
145
145
  * @see PicoString.sc
146
146
  */
147
- static snakecase: typeof PicoString.sc;
147
+ static snakecase: typeof Str.sc;
148
148
  /**
149
149
  * Convert to PascalCase
150
150
  *
@@ -157,7 +157,7 @@ export class PicoString {
157
157
  /**
158
158
  * @see PicoString.pc
159
159
  */
160
- static pascalcase: typeof PicoString.pc;
160
+ static pascalcase: typeof Str.pc;
161
161
  /**
162
162
  * Check if string contains value
163
163
  *
@@ -327,4 +327,5 @@ export namespace PicoString {
327
327
  function real(): void;
328
328
  function array(): void;
329
329
  }
330
- export default PicoString;
330
+ export default Str;
331
+ import { Str } from "../index.esm.js";