@kizmann/pico-js 2.1.0 → 2.1.2
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 +1 -1
- package/src/format/FormatParam.ts +1 -1
- package/src/utils/Cookie.ts +1 -1
- package/src/utils/Mixed.ts +24 -3
- package/types/utils/Mixed.d.ts +13 -0
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ export class PicoFormatParam
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
let result = Arr.each(value, (v : any, k : any) => {
|
|
56
|
-
return this.castParam(Mix.isArr(value) ? '' : k, v, key);
|
|
56
|
+
return this.castParam(Mix.isArr(value) && ! Mix.isObj(v) ? '' : k, v, key);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
return result.join('&');
|
package/src/utils/Cookie.ts
CHANGED
package/src/utils/Mixed.ts
CHANGED
|
@@ -43,6 +43,27 @@ export class PicoMixed
|
|
|
43
43
|
return this.len(value) === 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Check if the value is true
|
|
48
|
+
*
|
|
49
|
+
* @example Mix.isTrue('') // => false
|
|
50
|
+
* @example Mix.isTrue('foobar') // => true
|
|
51
|
+
* @example Mix.isTrue([]) // => false
|
|
52
|
+
* @example Mix.isTrue(['foobar']) // => true
|
|
53
|
+
* @example Mix.isTrue(false) // => false
|
|
54
|
+
*
|
|
55
|
+
* @param {any} value The value to test
|
|
56
|
+
* @returns {boolean} Returns true if value is true
|
|
57
|
+
*/
|
|
58
|
+
static isTrue(value : any) : boolean
|
|
59
|
+
{
|
|
60
|
+
if ( this.isBool(value) ) {
|
|
61
|
+
return this.bool(value) === true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return ! this.isEmpty(value);
|
|
65
|
+
}
|
|
66
|
+
|
|
46
67
|
/**
|
|
47
68
|
* Check if the value is null
|
|
48
69
|
*
|
|
@@ -549,14 +570,14 @@ export class PicoMixed
|
|
|
549
570
|
static extend(target : any, value : any, exclude : string[] = ['constructor'])
|
|
550
571
|
{
|
|
551
572
|
if ( value == null ) {
|
|
552
|
-
return
|
|
573
|
+
return target;
|
|
553
574
|
}
|
|
554
575
|
|
|
555
576
|
let proto = Object.getPrototypeOf(value);
|
|
556
577
|
|
|
557
578
|
for ( const key of Object.getOwnPropertyNames(value) ) {
|
|
558
579
|
|
|
559
|
-
if (
|
|
580
|
+
if ( exclude.length && Arr.has(exclude, key) ) {
|
|
560
581
|
continue;
|
|
561
582
|
}
|
|
562
583
|
|
|
@@ -566,7 +587,7 @@ export class PicoMixed
|
|
|
566
587
|
desc = Object.getOwnPropertyDescriptor(value, key);
|
|
567
588
|
}
|
|
568
589
|
|
|
569
|
-
if ( !desc
|
|
590
|
+
if ( !desc || (!desc.get && !desc.set) ) {
|
|
570
591
|
target[key] = value[key];
|
|
571
592
|
}
|
|
572
593
|
|
package/types/utils/Mixed.d.ts
CHANGED
|
@@ -16,6 +16,19 @@ export declare class PicoMixed {
|
|
|
16
16
|
* @returns {boolean} Returns true if value is not empty
|
|
17
17
|
*/
|
|
18
18
|
static isEmpty(value: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if the value is true
|
|
21
|
+
*
|
|
22
|
+
* @example Mix.isTrue('') // => false
|
|
23
|
+
* @example Mix.isTrue('foobar') // => true
|
|
24
|
+
* @example Mix.isTrue([]) // => false
|
|
25
|
+
* @example Mix.isTrue(['foobar']) // => true
|
|
26
|
+
* @example Mix.isTrue(false) // => false
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value The value to test
|
|
29
|
+
* @returns {boolean} Returns true if value is true
|
|
30
|
+
*/
|
|
31
|
+
static isTrue(value: any): boolean;
|
|
19
32
|
/**
|
|
20
33
|
* Check if the value is null
|
|
21
34
|
*
|