@kizmann/pico-js 2.0.8 → 2.0.10
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.
- package/dist/pico-js.browser.js +1 -1
- package/dist/pico-js.browser.js.map +1 -1
- package/dist/pico-js.esm.js +1 -1
- package/dist/pico-js.esm.js.map +1 -1
- package/package.json +4 -6
- package/src/dom/{DomAttribute.js → DomAttribute.ts} +40 -63
- package/src/dom/{DomBuilder.js → DomBuilder.ts} +27 -44
- package/src/dom/{DomEvent.js → DomEvent.ts} +74 -78
- package/src/dom/{DomFinder.js → DomFinder.ts} +89 -129
- package/src/dom/DomForm.ts +38 -0
- package/src/dom/{DomGlobal.js → DomGlobal.ts} +34 -51
- package/src/dom/{DomInview.js → DomInview.ts} +37 -57
- package/src/dom/DomMeta.ts +48 -0
- package/src/dom/DomObserver.ts +17 -0
- package/src/dom/{DomPopover.js → DomPopover.ts} +20 -39
- package/src/dom/{DomRectangle.js → DomRectangle.ts} +67 -88
- package/src/format/{FormatFile.js → FormatFile.ts} +12 -23
- package/src/format/{FormatOption.js → FormatOption.ts} +15 -24
- package/src/format/{FormatParam.js → FormatParam.ts} +14 -25
- package/src/format/{FormatParser.js → FormatParser.ts} +29 -39
- package/src/format/{FormatUrl.js → FormatUrl.ts} +9 -21
- package/src/index.browser.ts +32 -0
- package/src/index.esm.ts +64 -0
- package/src/now/{NowDefault.js → NowDefault.ts} +86 -121
- package/src/now/{NowFormat.js → NowFormat.ts} +23 -28
- package/src/now/{NowGrid.js → NowGrid.ts} +41 -58
- package/src/now/{NowHuman.js → NowHuman.ts} +18 -27
- package/src/now/{NowMatch.js → NowMatch.ts} +22 -28
- package/src/now/{NowRange.js → NowRange.ts} +13 -22
- package/src/now/{NowWalker.js → NowWalker.ts} +65 -71
- package/src/tool/{scope.js → scope.ts} +41 -11
- package/src/utils/{Array.js → Array.ts} +146 -160
- package/src/utils/{Cookie.js → Cookie.ts} +15 -12
- package/src/utils/{Data.js → Data.ts} +17 -17
- package/src/utils/Dom.ts +204 -0
- package/src/utils/Format.ts +48 -0
- package/src/utils/{Hash.js → Hash.ts} +20 -20
- package/src/utils/{Locale.js → Locale.ts} +22 -22
- package/src/utils/{Mixed.js → Mixed.ts} +70 -58
- package/src/utils/{Now.js → Now.ts} +68 -69
- package/src/utils/{Number.js → Number.ts} +34 -36
- package/src/utils/{Object.js → Object.ts} +68 -122
- package/src/utils/{Route.js → Route.ts} +11 -9
- package/src/utils/{Runner.js → Runner.ts} +65 -47
- package/src/utils/{Signal.js → Signal.ts} +35 -22
- package/src/utils/{String.js → String.ts} +79 -69
- package/src/wip/{Element.js → Element.ts} +2 -2
- package/src/wip/{Map.js → Map.ts} +131 -101
- package/types/dom/DomAttribute.d.ts +16 -27
- package/types/dom/DomBuilder.d.ts +6 -9
- package/types/dom/DomEvent.d.ts +19 -25
- package/types/dom/DomFinder.d.ts +35 -58
- package/types/dom/DomForm.d.ts +7 -10
- package/types/dom/DomGlobal.d.ts +8 -15
- package/types/dom/DomInview.d.ts +9 -19
- package/types/dom/DomMeta.d.ts +9 -16
- package/types/dom/DomObserver.d.ts +4 -8
- package/types/dom/DomPopover.d.ts +8 -11
- package/types/dom/DomRectangle.d.ts +21 -40
- package/types/format/FormatFile.d.ts +5 -8
- package/types/format/FormatOption.d.ts +6 -8
- package/types/format/FormatParam.d.ts +6 -9
- package/types/format/FormatParser.d.ts +10 -18
- package/types/format/FormatUrl.d.ts +5 -8
- package/types/index.esm.d.ts +25 -37
- package/types/now/NowDefault.d.ts +30 -99
- package/types/now/NowFormat.d.ts +8 -21
- package/types/now/NowGrid.d.ts +24 -46
- package/types/now/NowHuman.d.ts +10 -11
- package/types/now/NowMatch.d.ts +6 -4
- package/types/now/NowRange.d.ts +5 -8
- package/types/now/NowWalker.d.ts +6 -4
- package/types/tool/scope.d.ts +11 -3
- package/types/utils/Array.d.ts +83 -104
- package/types/utils/Cookie.d.ts +11 -8
- package/types/utils/Data.d.ts +7 -7
- package/types/utils/Dom.d.ts +63 -96
- package/types/utils/Format.d.ts +15 -28
- package/types/utils/Hash.d.ts +21 -21
- package/types/utils/Locale.d.ts +10 -10
- package/types/utils/Mixed.d.ts +18 -32
- package/types/utils/Now.d.ts +51 -56
- package/types/utils/Number.d.ts +9 -20
- package/types/utils/Object.d.ts +21 -36
- package/types/utils/Route.d.ts +5 -2
- package/types/utils/Runner.d.ts +41 -24
- package/types/utils/Signal.d.ts +16 -16
- package/types/utils/String.d.ts +40 -76
- package/src/dom/DomForm.js +0 -59
- package/src/dom/DomMeta.js +0 -68
- package/src/dom/DomObserver.js +0 -38
- package/src/index.browser.js +0 -36
- package/src/index.esm.js +0 -80
- package/src/utils/Dom.js +0 -214
- package/src/utils/Format.js +0 -62
- package/types/wip/Element.d.ts +0 -119
- package/types/wip/Map.d.ts +0 -254
package/types/utils/Array.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Arr } from "../index.esm.ts";
|
|
2
|
+
export declare class PicoArray {
|
|
2
3
|
/**
|
|
3
4
|
* Wrap value into an array
|
|
4
5
|
*
|
|
@@ -26,24 +27,24 @@ export class PicoArray {
|
|
|
26
27
|
*
|
|
27
28
|
* @example Arr.set([1,2], 0, 9) // => [9,2]
|
|
28
29
|
*
|
|
29
|
-
* @param {
|
|
30
|
+
* @param {any} target Target array
|
|
30
31
|
* @param {number} index Index to set
|
|
31
32
|
* @param {any} value Value to set
|
|
32
33
|
* @returns {any} Splice result
|
|
33
34
|
*/
|
|
34
|
-
static set(target:
|
|
35
|
+
static set(target: any, index: number, value: any): any;
|
|
35
36
|
/**
|
|
36
37
|
* Remove item at index (mutates)
|
|
37
38
|
*
|
|
38
39
|
* @example Arr.unset([1,2], 0) // => [1]
|
|
39
40
|
*
|
|
40
|
-
* @param {
|
|
41
|
+
* @param {any} target Target array
|
|
41
42
|
* @param {number} index Index to remove
|
|
42
43
|
* @returns {any} Splice result
|
|
43
44
|
*/
|
|
44
|
-
static unset(target:
|
|
45
|
-
static prev(target: any, index:
|
|
46
|
-
static next(target: any, index:
|
|
45
|
+
static unset(target: any, index: number): any;
|
|
46
|
+
static prev(target: any, index: number): number;
|
|
47
|
+
static next(target: any, index: number): number;
|
|
47
48
|
/**
|
|
48
49
|
* Create array with callback values
|
|
49
50
|
*
|
|
@@ -71,67 +72,67 @@ export class PicoArray {
|
|
|
71
72
|
*
|
|
72
73
|
* @example Arr.unique(["a","a"]) // => ["a"]
|
|
73
74
|
*
|
|
74
|
-
* @param {
|
|
75
|
+
* @param {any[]} value Input list
|
|
75
76
|
* @returns {Array<any>} Unique list
|
|
76
77
|
*/
|
|
77
|
-
static unique(value:
|
|
78
|
+
static unique(value: any[]): Array<any>;
|
|
78
79
|
/**
|
|
79
80
|
* Check equal lengths for arrays
|
|
80
81
|
*
|
|
81
82
|
* @example Arr.lengths([1],[2]) // => true
|
|
82
83
|
*
|
|
83
|
-
* @param {
|
|
84
|
-
* @param {...
|
|
84
|
+
* @param {any[]} value Base array
|
|
85
|
+
* @param {[...any[]]} args Other arrays
|
|
85
86
|
* @returns {boolean} True if equal
|
|
86
87
|
*/
|
|
87
|
-
static lengths(value:
|
|
88
|
+
static lengths(value: any[], ...args: [...any[]]): boolean;
|
|
88
89
|
/**
|
|
89
90
|
* Get first item or fallback
|
|
90
91
|
*
|
|
91
92
|
* @example Arr.first([1,2]) // => 1
|
|
92
93
|
*
|
|
93
|
-
* @param {
|
|
94
|
+
* @param {any} value Input array
|
|
94
95
|
* @param {any} [fallback] Fallback value
|
|
95
96
|
* @returns {any} First item
|
|
96
97
|
*/
|
|
97
|
-
static first(value:
|
|
98
|
+
static first(value: any, fallback?: any): any;
|
|
98
99
|
/**
|
|
99
100
|
* Get second item or fallback
|
|
100
101
|
*
|
|
101
102
|
* @example Arr.second([1,2]) // => 2
|
|
102
103
|
*
|
|
103
|
-
* @param {
|
|
104
|
+
* @param {any} value Input array
|
|
104
105
|
* @param {any} [fallback] Fallback value
|
|
105
106
|
* @returns {any} Second item
|
|
106
107
|
*/
|
|
107
|
-
static second(value:
|
|
108
|
+
static second(value: any, fallback?: any): any;
|
|
108
109
|
/**
|
|
109
110
|
* Get third item or fallback
|
|
110
111
|
*
|
|
111
112
|
* @example Arr.third([1,2,3]) // => 3
|
|
112
113
|
*
|
|
113
|
-
* @param {
|
|
114
|
+
* @param {any} value Input array
|
|
114
115
|
* @param {any} [fallback] Fallback value
|
|
115
116
|
* @returns {any} Third item
|
|
116
117
|
*/
|
|
117
|
-
static third(value:
|
|
118
|
+
static third(value: any, fallback?: any): any;
|
|
118
119
|
/**
|
|
119
120
|
* Get last item or fallback
|
|
120
121
|
*
|
|
121
122
|
* @example Arr.last([1,2]) // => 2
|
|
122
123
|
*
|
|
123
|
-
* @param {
|
|
124
|
+
* @param {any} value Input array
|
|
124
125
|
* @param {any} [fallback] Fallback value
|
|
125
126
|
* @returns {any} Last item
|
|
126
127
|
*/
|
|
127
|
-
static last(value:
|
|
128
|
+
static last(value: any, fallback?: any): any;
|
|
128
129
|
/**
|
|
129
130
|
* Map values to new array
|
|
130
131
|
*
|
|
131
132
|
* @example Arr.each([1], v => v+1) // => [2]
|
|
132
133
|
*
|
|
133
134
|
* @param {any} value Input list
|
|
134
|
-
* @param {
|
|
135
|
+
* @param {Function} cb Map callback
|
|
135
136
|
* @param {any} [retval] Forced return
|
|
136
137
|
* @returns {any} Mapped array
|
|
137
138
|
*/
|
|
@@ -142,7 +143,7 @@ export class PicoArray {
|
|
|
142
143
|
* @example Arr.eachObj({a:1}, (v,k) => v+1) // => [2]
|
|
143
144
|
*
|
|
144
145
|
* @param {any} value Input object
|
|
145
|
-
* @param {
|
|
146
|
+
* @param {Function} cb Iterate callback
|
|
146
147
|
* @param {any} [retval] Return value override
|
|
147
148
|
* @returns {any} Mapped values or retval
|
|
148
149
|
*/
|
|
@@ -153,7 +154,7 @@ export class PicoArray {
|
|
|
153
154
|
* @example Arr.map([1], v => v+1) // => [2]
|
|
154
155
|
*
|
|
155
156
|
* @param {any} value Input list
|
|
156
|
-
* @param {
|
|
157
|
+
* @param {Function} cb Map callback
|
|
157
158
|
* @returns {any} Mutated input
|
|
158
159
|
*/
|
|
159
160
|
static map(value: any, cb: Function): any;
|
|
@@ -164,12 +165,12 @@ export class PicoArray {
|
|
|
164
165
|
*
|
|
165
166
|
* @param {any} value Input list
|
|
166
167
|
* @param {string} key Child key
|
|
167
|
-
* @param {
|
|
168
|
-
* @param {
|
|
168
|
+
* @param {Function} cb Node callback
|
|
169
|
+
* @param {any[]} [cascade] Parent chain
|
|
169
170
|
* @returns {any} Mapped tree
|
|
170
171
|
*/
|
|
171
|
-
static recursive(value: any, key: string, cb: Function, cascade?:
|
|
172
|
-
static cascade(value: any, childs:
|
|
172
|
+
static recursive(value: any, key: string, cb: Function, cascade?: any[]): any;
|
|
173
|
+
static cascade(value: any, childs: string, key: string, cascade?: any[], result?: any): any;
|
|
173
174
|
/**
|
|
174
175
|
* Get matching indexes by filter
|
|
175
176
|
*
|
|
@@ -177,9 +178,9 @@ export class PicoArray {
|
|
|
177
178
|
*
|
|
178
179
|
* @param {any} value Input list
|
|
179
180
|
* @param {any} [filter] Filter spec
|
|
180
|
-
* @returns {Array<
|
|
181
|
+
* @returns {Array<any>} Matching keys
|
|
181
182
|
*/
|
|
182
|
-
static filterIndex(value: any, filter?: any): Array<
|
|
183
|
+
static filterIndex(value: any, filter?: any): Array<any>;
|
|
183
184
|
/**
|
|
184
185
|
* Remove values matching filter (mutates)
|
|
185
186
|
*
|
|
@@ -205,23 +206,23 @@ export class PicoArray {
|
|
|
205
206
|
*
|
|
206
207
|
* @example Arr.findIndex([1,2], 2) // => 1
|
|
207
208
|
*
|
|
208
|
-
* @param {
|
|
209
|
+
* @param {any} value Input array
|
|
209
210
|
* @param {any} [filter] Filter spec
|
|
210
211
|
* @param {number} [fallback] Fallback index
|
|
211
212
|
* @returns {number} Found index
|
|
212
213
|
*/
|
|
213
|
-
static findIndex(value:
|
|
214
|
+
static findIndex(value: any, filter?: any, fallback?: number): number;
|
|
214
215
|
/**
|
|
215
216
|
* Find value matching filter
|
|
216
217
|
*
|
|
217
218
|
* @example Arr.find([1,2], 2) // => 2
|
|
218
219
|
*
|
|
219
|
-
* @param {
|
|
220
|
+
* @param {any} value Input array
|
|
220
221
|
* @param {any} [filter] Filter spec
|
|
221
222
|
* @param {any} [fallback] Fallback value
|
|
222
223
|
* @returns {any} Found value
|
|
223
224
|
*/
|
|
224
|
-
static find(value:
|
|
225
|
+
static find(value: any, filter?: any, fallback?: any): any;
|
|
225
226
|
/**
|
|
226
227
|
* Sort array by key or callback
|
|
227
228
|
*
|
|
@@ -238,7 +239,7 @@ export class PicoArray {
|
|
|
238
239
|
* @example Arr.sortFunc([2,1], (a,b)=>a-b) // => [1,2]
|
|
239
240
|
*
|
|
240
241
|
* @param {any} value Input list
|
|
241
|
-
* @param {
|
|
242
|
+
* @param {Function} cb Compare callback
|
|
242
243
|
* @returns {Array<any>} Sorted list
|
|
243
244
|
*/
|
|
244
245
|
static sortFunc(value: any, cb: Function): Array<any>;
|
|
@@ -266,121 +267,121 @@ export class PicoArray {
|
|
|
266
267
|
*
|
|
267
268
|
* @example Arr.merge([1],[2]) // => [1,2]
|
|
268
269
|
*
|
|
269
|
-
* @param {
|
|
270
|
-
* @param {...any} args Arrays to add
|
|
270
|
+
* @param {any[]} value Base array
|
|
271
|
+
* @param {[...any[]]} args Arrays to add
|
|
271
272
|
* @returns {Array<any>} Merged array
|
|
272
273
|
*/
|
|
273
|
-
static merge(value:
|
|
274
|
+
static merge(value: any[], ...args: [...any[]]): Array<any>;
|
|
274
275
|
/**
|
|
275
276
|
* Prepend items (mutates)
|
|
276
277
|
*
|
|
277
278
|
* @example Arr.prepend([2], 1) // => [1,2]
|
|
278
279
|
*
|
|
279
|
-
* @param {
|
|
280
|
-
* @param {...any} args Items to add
|
|
280
|
+
* @param {any[]} value Target array
|
|
281
|
+
* @param {[...any[]]} args Items to add
|
|
281
282
|
* @returns {Array<any>} Mutated array
|
|
282
283
|
*/
|
|
283
|
-
static prepend(value:
|
|
284
|
+
static prepend(value: any[], ...args: [...any[]]): Array<any>;
|
|
284
285
|
/**
|
|
285
286
|
* Append items (mutates)
|
|
286
287
|
*
|
|
287
288
|
* @example Arr.append([1], 2) // => [1,2]
|
|
288
289
|
*
|
|
289
|
-
* @param {
|
|
290
|
-
* @param {...any} args Items to add
|
|
290
|
+
* @param {any[]} value Target array
|
|
291
|
+
* @param {[...any[]]} args Items to add
|
|
291
292
|
* @returns {Array<any>} Mutated array
|
|
292
293
|
*/
|
|
293
|
-
static append(value:
|
|
294
|
+
static append(value: any[], ...args: [...any[]]): Array<any>;
|
|
294
295
|
/**
|
|
295
296
|
* Add item if not present
|
|
296
297
|
*
|
|
297
298
|
* @example Arr.add([1], 2) // => [1,2]
|
|
298
299
|
*
|
|
299
|
-
* @param {
|
|
300
|
+
* @param {any[]} value Target array
|
|
300
301
|
* @param {any} target Item to add
|
|
301
302
|
* @param {any} [finder] Finder value
|
|
302
303
|
* @returns {Array<any>} Mutated array
|
|
303
304
|
*/
|
|
304
|
-
static add(value:
|
|
305
|
+
static add(value: any[], target: any, finder?: any): Array<any>;
|
|
305
306
|
/**
|
|
306
307
|
* Replace existing item or add
|
|
307
308
|
*
|
|
308
309
|
* @example Arr.replace([1], 2) // => [1,2]
|
|
309
310
|
*
|
|
310
|
-
* @param {
|
|
311
|
+
* @param {any[]} value Target array
|
|
311
312
|
* @param {any} target Item to add
|
|
312
313
|
* @param {any} [finder] Finder value
|
|
313
314
|
* @returns {Array<any>} Mutated array
|
|
314
315
|
*/
|
|
315
|
-
static replace(value:
|
|
316
|
+
static replace(value: any[], target: any, finder?: any): Array<any>;
|
|
316
317
|
/**
|
|
317
318
|
* Remove item if present
|
|
318
319
|
*
|
|
319
320
|
* @example Arr.remove([1,2], 1) // => [2]
|
|
320
321
|
*
|
|
321
|
-
* @param {
|
|
322
|
+
* @param {any[]} value Target array
|
|
322
323
|
* @param {any} target Item to remove
|
|
323
324
|
* @param {any} [finder] Finder value
|
|
324
325
|
* @returns {Array<any>} Mutated array
|
|
325
326
|
*/
|
|
326
|
-
static remove(value:
|
|
327
|
+
static remove(value: any[], target: any, finder?: any): Array<any>;
|
|
327
328
|
/**
|
|
328
329
|
* Toggle item in array
|
|
329
330
|
*
|
|
330
331
|
* @example Arr.toggle([1], 1) // => []
|
|
331
332
|
* @example Arr.toggle([], 1) // => [1]
|
|
332
333
|
*
|
|
333
|
-
* @param {
|
|
334
|
+
* @param {any[]} value Target array
|
|
334
335
|
* @param {any} target Item to toggle
|
|
335
336
|
* @param {any} [finder] Finder value
|
|
336
337
|
* @returns {Array<any>} Mutated array
|
|
337
338
|
*/
|
|
338
|
-
static toggle(value:
|
|
339
|
+
static toggle(value: any[], target: any, finder?: any): Array<any>;
|
|
339
340
|
/**
|
|
340
341
|
* Insert item at index (mutates)
|
|
341
342
|
*
|
|
342
343
|
* @example Arr.insert([1,3], 1, 2) // => [1,2,3]
|
|
343
344
|
*
|
|
344
|
-
* @param {
|
|
345
|
+
* @param {any[]} value Target array
|
|
345
346
|
* @param {number} index Insert index
|
|
346
347
|
* @param {any} target Item to insert
|
|
347
348
|
* @returns {Array<any>} Mutated array
|
|
348
349
|
*/
|
|
349
|
-
static insert(value:
|
|
350
|
+
static insert(value: any[], index: number, target: any): Array<any>;
|
|
350
351
|
/**
|
|
351
352
|
* Slice array from index
|
|
352
353
|
*
|
|
353
354
|
* @example Arr.slice([1,2,3], 1, 2) // => [2,3]
|
|
354
355
|
*
|
|
355
|
-
* @param {
|
|
356
|
-
* @param {
|
|
356
|
+
* @param {any[]} value Source array
|
|
357
|
+
* @param {any} index Start index
|
|
357
358
|
* @param {number} [length] Slice length
|
|
358
359
|
* @returns {Array<any>} Sliced array
|
|
359
360
|
*/
|
|
360
|
-
static slice(value:
|
|
361
|
+
static slice(value: any[], index: any, length?: number): Array<any>;
|
|
361
362
|
/**
|
|
362
363
|
* Splice array (mutates)
|
|
363
364
|
*
|
|
364
365
|
* @example Arr.splice([1,2], 0, 1) // => [1]
|
|
365
366
|
*
|
|
366
|
-
* @param {
|
|
367
|
-
* @param {
|
|
367
|
+
* @param {any[]} value Target array
|
|
368
|
+
* @param {any} index Start index
|
|
368
369
|
* @param {number} [length] Remove count
|
|
369
|
-
* @param {...any} args Items to add
|
|
370
|
-
* @returns {any} Splice result
|
|
370
|
+
* @param {[...any]} args Items to add
|
|
371
|
+
* @returns {Array<any>} Splice result
|
|
371
372
|
*/
|
|
372
|
-
static splice(value:
|
|
373
|
+
static splice(value: any[], index: any, length?: number, ...args: [...any]): Array<any>;
|
|
373
374
|
/**
|
|
374
375
|
* Splice multiple indexes
|
|
375
376
|
*
|
|
376
377
|
* @example Arr.splices([1,2,3],[0,2]) // => [2]
|
|
377
378
|
*
|
|
378
|
-
* @param {
|
|
379
|
-
* @param {
|
|
379
|
+
* @param {any[]} value Target array
|
|
380
|
+
* @param {any[]} indexies Index list
|
|
380
381
|
* @param {number} [length] Remove count
|
|
381
382
|
* @returns {Array<any>} Mutated array
|
|
382
383
|
*/
|
|
383
|
-
static splices(value:
|
|
384
|
+
static splices(value: any[], indexies: any[], length?: number): Array<any>;
|
|
384
385
|
/**
|
|
385
386
|
* Deep clone array/object
|
|
386
387
|
*
|
|
@@ -395,36 +396,44 @@ export class PicoArray {
|
|
|
395
396
|
*
|
|
396
397
|
* @example Arr.diff([1,2],[2]) // => [1]
|
|
397
398
|
*
|
|
398
|
-
* @param {...
|
|
399
|
+
* @param {[...any[]]} args Arrays to diff
|
|
399
400
|
* @returns {Array<any>} Difference list
|
|
400
401
|
*/
|
|
401
|
-
static diff(...args:
|
|
402
|
+
static diff(...args: [...any[]]): Array<any>;
|
|
403
|
+
/**
|
|
404
|
+
* @see PicoArray.diff
|
|
405
|
+
*/
|
|
406
|
+
static diffrence: typeof Arr.diff;
|
|
402
407
|
/**
|
|
403
408
|
* Get intersecting items
|
|
404
409
|
*
|
|
405
410
|
* @example Arr.isect([1,2],[2,3]) // => [2]
|
|
406
411
|
*
|
|
407
|
-
* @param {...
|
|
412
|
+
* @param {[...any[]]} args Arrays to intersect
|
|
408
413
|
* @returns {Array<any>} Intersection list
|
|
409
414
|
*/
|
|
410
|
-
static isect(...args:
|
|
415
|
+
static isect(...args: [...any[]]): Array<any>;
|
|
416
|
+
/**
|
|
417
|
+
* @see PicoArray.diff
|
|
418
|
+
*/
|
|
419
|
+
static intersect: typeof Arr.isect;
|
|
411
420
|
/**
|
|
412
421
|
* Extract property values from list
|
|
413
422
|
*
|
|
414
423
|
* @example Arr.extract([{id:1}], "id") // => [1]
|
|
415
424
|
*
|
|
416
|
-
* @param {
|
|
425
|
+
* @param {any[]} value Input list
|
|
417
426
|
* @param {any} key Key path
|
|
418
427
|
* @returns {Array<any>} Extracted list
|
|
419
428
|
*/
|
|
420
|
-
static extract(value:
|
|
429
|
+
static extract(value: any, key: any): Array<any>;
|
|
421
430
|
/**
|
|
422
431
|
* Reduce list values
|
|
423
432
|
*
|
|
424
433
|
* @example Arr.reduce([1,2], (a,c)=>a+c, 0) // => 3
|
|
425
434
|
*
|
|
426
435
|
* @param {any} value Input list
|
|
427
|
-
* @param {
|
|
436
|
+
* @param {Function} callback Reducer callback
|
|
428
437
|
* @param {any} accumulator Start value
|
|
429
438
|
* @returns {any} Reduced value
|
|
430
439
|
*/
|
|
@@ -434,11 +443,11 @@ export class PicoArray {
|
|
|
434
443
|
*
|
|
435
444
|
* @example Arr.chunk([1,2,3], 2) // => [[1,2],[3]]
|
|
436
445
|
*
|
|
437
|
-
* @param {
|
|
446
|
+
* @param {any[]} value Source array
|
|
438
447
|
* @param {number} [chunk] Chunk size
|
|
439
|
-
* @returns {Array<
|
|
448
|
+
* @returns {Array<any[]>} Chunked list
|
|
440
449
|
*/
|
|
441
|
-
static chunk(value:
|
|
450
|
+
static chunk(value: any[], chunk?: number): Array<any[]>;
|
|
442
451
|
/**
|
|
443
452
|
* Check if value includes search
|
|
444
453
|
*
|
|
@@ -471,34 +480,4 @@ export class PicoArray {
|
|
|
471
480
|
*/
|
|
472
481
|
static matches(value: any, search: any): boolean;
|
|
473
482
|
}
|
|
474
|
-
export namespace PicoArray {
|
|
475
|
-
/**
|
|
476
|
-
* @see PicoArray.unset
|
|
477
|
-
*/
|
|
478
|
-
function removeIndex(...args: any[]): any;
|
|
479
|
-
/**
|
|
480
|
-
* @see PicoArray.sortPrim
|
|
481
|
-
*/
|
|
482
|
-
function sortString(...args: any[]): any[];
|
|
483
|
-
/**
|
|
484
|
-
* @see PicoArray.append
|
|
485
|
-
*/
|
|
486
|
-
function push(...args: any[]): any[];
|
|
487
|
-
/**
|
|
488
|
-
* @see PicoArray.merge
|
|
489
|
-
*/
|
|
490
|
-
function concat(...args: any[]): any[];
|
|
491
|
-
/**
|
|
492
|
-
* @see PicoArray.matches
|
|
493
|
-
*/
|
|
494
|
-
function equal(...args: any[]): boolean;
|
|
495
|
-
/**
|
|
496
|
-
* @see PicoArray.diff
|
|
497
|
-
*/
|
|
498
|
-
function diffrence(...args: any[]): any[];
|
|
499
|
-
/**
|
|
500
|
-
* @see PicoArray.isect
|
|
501
|
-
*/
|
|
502
|
-
function intersect(...args: any[]): any[];
|
|
503
|
-
}
|
|
504
483
|
export default PicoArray;
|
package/types/utils/Cookie.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export class PicoCookie {
|
|
1
|
+
export declare const COOKIE_REGEX: {
|
|
2
|
+
entry: RegExp;
|
|
3
|
+
};
|
|
4
|
+
export declare class PicoCookie {
|
|
5
|
+
/**
|
|
6
|
+
* @type {Record<string, any>}
|
|
7
|
+
*/
|
|
5
8
|
static $cookie: any;
|
|
6
9
|
/**
|
|
7
10
|
* Read raw document.cookie
|
|
@@ -43,9 +46,9 @@ export class PicoCookie {
|
|
|
43
46
|
* @param {any} value Cookie value
|
|
44
47
|
* @param {any} [expire] Expire date spec
|
|
45
48
|
* @param {any} [options] Cookie options
|
|
46
|
-
* @returns {
|
|
49
|
+
* @returns {PicoCookie} Cookie class
|
|
47
50
|
*/
|
|
48
|
-
static set(key: string, value: any, expire?: any, options?: any):
|
|
51
|
+
static set(key: string, value: any, expire?: any, options?: any): PicoCookie;
|
|
49
52
|
/**
|
|
50
53
|
* Remove cookie by key
|
|
51
54
|
*
|
|
@@ -53,8 +56,8 @@ export class PicoCookie {
|
|
|
53
56
|
*
|
|
54
57
|
* @param {string} key Cookie key
|
|
55
58
|
* @param {any} [options] Cookie options
|
|
56
|
-
* @returns {
|
|
59
|
+
* @returns {PicoCookie} Cookie class
|
|
57
60
|
*/
|
|
58
|
-
static forget(key: string, options?: any):
|
|
61
|
+
static forget(key: string, options?: any): PicoCookie;
|
|
59
62
|
}
|
|
60
63
|
export default PicoCookie;
|
package/types/utils/Data.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export class PicoData {
|
|
1
|
+
export declare class PicoData {
|
|
2
2
|
/**
|
|
3
3
|
* In-memory data store
|
|
4
4
|
*
|
|
5
|
-
* @type {
|
|
5
|
+
* @type {any}
|
|
6
6
|
*/
|
|
7
|
-
static $data:
|
|
7
|
+
static $data: any;
|
|
8
8
|
/**
|
|
9
9
|
* Check if store key exists
|
|
10
10
|
*
|
|
@@ -73,19 +73,19 @@ export class PicoData {
|
|
|
73
73
|
* @example Data.add(["list"], 1, 2)
|
|
74
74
|
*
|
|
75
75
|
* @param {any} input Store key input
|
|
76
|
-
* @param {...any} args Items to add
|
|
76
|
+
* @param {[...any]} args Items to add
|
|
77
77
|
* @returns {void} No return value
|
|
78
78
|
*/
|
|
79
|
-
static add(input: any, ...args: any
|
|
79
|
+
static add(input: any, ...args: [...any]): void;
|
|
80
80
|
/**
|
|
81
81
|
* Remove items from array store
|
|
82
82
|
*
|
|
83
83
|
* @example Data.remove(["list"], 1)
|
|
84
84
|
*
|
|
85
85
|
* @param {any} input Store key input
|
|
86
|
-
* @param {...any} args Items to remove
|
|
86
|
+
* @param {[...any]} args Items to remove
|
|
87
87
|
* @returns {void} No return value
|
|
88
88
|
*/
|
|
89
|
-
static remove(input: any, ...args: any
|
|
89
|
+
static remove(input: any, ...args: [...any]): void;
|
|
90
90
|
}
|
|
91
91
|
export default PicoData;
|