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