@ng-util/util 12.1.2 → 14.0.0

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.
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@ng-util/util/convert" />
4
5
  export * from './public-api';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbENvbnZlcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbnZlcnQvdXRpbENvbnZlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
File without changes
@@ -3,4 +3,4 @@ export * from '@ng-util/util/convert';
3
3
  /**
4
4
  * Generated bundle index. Do not edit.
5
5
  */
6
- //# sourceMappingURL=util.js.map
6
+ //# sourceMappingURL=util.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.mjs","sources":["../../../../packages/util/util.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
@@ -56,4 +56,4 @@ function InputNumber(defaultValue = 0) {
56
56
  */
57
57
 
58
58
  export { InputBoolean, InputNumber, toBoolean, toNumber };
59
- //# sourceMappingURL=convert.js.map
59
+ //# sourceMappingURL=utilConvert.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilConvert.mjs","sources":["../../../../packages/util/convert/prop.ts","../../../../packages/util/convert/utilConvert.ts"],"sourcesContent":["function propDecoratorFactory<T, D>(\n name: string,\n fallback: (v: T, defaultValue: D) => D,\n defaultValue: any,\n): (target: any, propName: string) => void {\n function propDecorator(target: any, propName: string, originalDescriptor?: TypedPropertyDescriptor<any>): any {\n const privatePropName = `$$__${propName}`;\n\n if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {\n console.warn(`The prop \"${privatePropName}\" is already exist, it will be overrided by ${name} decorator.`);\n }\n\n Object.defineProperty(target, privatePropName, {\n configurable: true,\n writable: true,\n });\n\n return {\n get(): string {\n return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];\n },\n set(value: T): void {\n if (originalDescriptor && originalDescriptor.set) {\n originalDescriptor.set.bind(this)(fallback(value, defaultValue));\n }\n this[privatePropName] = fallback(value, defaultValue);\n },\n };\n }\n\n return propDecorator;\n}\n\nexport function toBoolean(value: any, allowUndefined: boolean | null = false): boolean | undefined {\n return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false';\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toBoolean\n *\n * ```ts\n * @Input() InputBoolean() visible: boolean = false;\n * @Input() @InputBoolean(null) visible: boolean = false;\n * ```\n */\nexport function InputBoolean(defaultValue: boolean | null = false): any {\n return propDecoratorFactory('InputNumber', toBoolean, defaultValue);\n}\n\nexport function toNumber(value: any): number;\nexport function toNumber<D>(value: any, fallback: D): number | D;\nexport function toNumber(value: any, fallbackValue: number = 0): number {\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toNumber\n *\n * ```ts\n * @Input() @InputNumber() visible: number = 1;\n * @Input() @InputNumber(null) visible: number = 2;\n * ```\n */\nexport function InputNumber(defaultValue: number | null = 0): any {\n return propDecoratorFactory('InputNumber', toNumber, defaultValue);\n}\n","/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C1E,OAAO,cAAc,IAAI,OAAO,KAAK,KAAK,WAAW,GAAG,SAAS,GAAG,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,CAAA,CAAE,KAAK,OAAO,CAAC;AAC9G,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,YAAY,CAAC,YAAA,GAA+B,KAAK,EAAA;IAC/D,OAAO,oBAAoB,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AACtE,CAAC;SAIe,QAAQ,CAAC,KAAU,EAAE,gBAAwB,CAAC,EAAA;AAC5D,IAAA,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;AACnG,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,WAAW,CAAC,YAAA,GAA8B,CAAC,EAAA;IACzD,OAAO,oBAAoB,CAAC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrE;;ACjEA;;AAEG;;;;"}
@@ -0,0 +1,6 @@
1
+ export * from '@ng-util/util/convert';
2
+
3
+ /**
4
+ * Generated bundle index. Do not edit.
5
+ */
6
+ //# sourceMappingURL=util.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.mjs","sources":["../../../../packages/util/util.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
@@ -0,0 +1,59 @@
1
+ function propDecoratorFactory(name, fallback, defaultValue) {
2
+ function propDecorator(target, propName, originalDescriptor) {
3
+ const privatePropName = `$$__${propName}`;
4
+ if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
5
+ console.warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
6
+ }
7
+ Object.defineProperty(target, privatePropName, {
8
+ configurable: true,
9
+ writable: true,
10
+ });
11
+ return {
12
+ get() {
13
+ return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];
14
+ },
15
+ set(value) {
16
+ if (originalDescriptor && originalDescriptor.set) {
17
+ originalDescriptor.set.bind(this)(fallback(value, defaultValue));
18
+ }
19
+ this[privatePropName] = fallback(value, defaultValue);
20
+ },
21
+ };
22
+ }
23
+ return propDecorator;
24
+ }
25
+ function toBoolean(value, allowUndefined = false) {
26
+ return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false';
27
+ }
28
+ /**
29
+ * Input decorator that handle a prop to do get/set automatically with toBoolean
30
+ *
31
+ * ```ts
32
+ * @Input() InputBoolean() visible: boolean = false;
33
+ * @Input() @InputBoolean(null) visible: boolean = false;
34
+ * ```
35
+ */
36
+ function InputBoolean(defaultValue = false) {
37
+ return propDecoratorFactory('InputNumber', toBoolean, defaultValue);
38
+ }
39
+ function toNumber(value, fallbackValue = 0) {
40
+ return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
41
+ }
42
+ /**
43
+ * Input decorator that handle a prop to do get/set automatically with toNumber
44
+ *
45
+ * ```ts
46
+ * @Input() @InputNumber() visible: number = 1;
47
+ * @Input() @InputNumber(null) visible: number = 2;
48
+ * ```
49
+ */
50
+ function InputNumber(defaultValue = 0) {
51
+ return propDecoratorFactory('InputNumber', toNumber, defaultValue);
52
+ }
53
+
54
+ /**
55
+ * Generated bundle index. Do not edit.
56
+ */
57
+
58
+ export { InputBoolean, InputNumber, toBoolean, toNumber };
59
+ //# sourceMappingURL=utilConvert.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilConvert.mjs","sources":["../../../../packages/util/convert/prop.ts","../../../../packages/util/convert/utilConvert.ts"],"sourcesContent":["function propDecoratorFactory<T, D>(\n name: string,\n fallback: (v: T, defaultValue: D) => D,\n defaultValue: any,\n): (target: any, propName: string) => void {\n function propDecorator(target: any, propName: string, originalDescriptor?: TypedPropertyDescriptor<any>): any {\n const privatePropName = `$$__${propName}`;\n\n if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {\n console.warn(`The prop \"${privatePropName}\" is already exist, it will be overrided by ${name} decorator.`);\n }\n\n Object.defineProperty(target, privatePropName, {\n configurable: true,\n writable: true,\n });\n\n return {\n get(): string {\n return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];\n },\n set(value: T): void {\n if (originalDescriptor && originalDescriptor.set) {\n originalDescriptor.set.bind(this)(fallback(value, defaultValue));\n }\n this[privatePropName] = fallback(value, defaultValue);\n },\n };\n }\n\n return propDecorator;\n}\n\nexport function toBoolean(value: any, allowUndefined: boolean | null = false): boolean | undefined {\n return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false';\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toBoolean\n *\n * ```ts\n * @Input() InputBoolean() visible: boolean = false;\n * @Input() @InputBoolean(null) visible: boolean = false;\n * ```\n */\nexport function InputBoolean(defaultValue: boolean | null = false): any {\n return propDecoratorFactory('InputNumber', toBoolean, defaultValue);\n}\n\nexport function toNumber(value: any): number;\nexport function toNumber<D>(value: any, fallback: D): number | D;\nexport function toNumber(value: any, fallbackValue: number = 0): number {\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toNumber\n *\n * ```ts\n * @Input() @InputNumber() visible: number = 1;\n * @Input() @InputNumber(null) visible: number = 2;\n * ```\n */\nexport function InputNumber(defaultValue: number | null = 0): any {\n return propDecoratorFactory('InputNumber', toNumber, defaultValue);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA,SAAS,oBAAoB,CAC3B,IAAY,EACZ,QAAsC,EACtC,YAAiB,EAAA;AAEjB,IAAA,SAAS,aAAa,CAAC,MAAW,EAAE,QAAgB,EAAE,kBAAiD,EAAA;AACrG,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K,EAAA;IAC/D,OAAO,oBAAoB,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AACtE,CAAC;SAIe,QAAQ,CAAC,KAAU,EAAE,gBAAwB,CAAC,EAAA;AAC5D,IAAA,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;AACnG,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,WAAW,CAAC,YAAA,GAA8B,CAAC,EAAA;IACzD,OAAO,oBAAoB,CAAC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrE;;ACjEA;;AAEG;;;;"}
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@ng-util/util" />
4
5
  export * from './public-api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-util/util",
3
- "version": "12.1.2",
3
+ "version": "14.0.0",
4
4
  "author": "cipchk<cipchk@qq.com>",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,17 +14,38 @@
14
14
  "keywords": [
15
15
  "angular",
16
16
  "util",
17
- "Angular utilities"
17
+ "Angular utilities",
18
+ "angular standalone library"
18
19
  ],
19
20
  "sideEffects": false,
20
- "main": "bundles/util.umd.js",
21
- "module": "fesm2015/util.js",
22
- "es2015": "fesm2015/util.js",
23
- "esm2015": "esm2015/util.js",
24
- "fesm2015": "fesm2015/util.js",
25
- "typings": "util.d.ts",
26
- "metadata": "util.metadata.json",
21
+ "module": "fesm2015/util.mjs",
22
+ "es2020": "fesm2020/util.mjs",
23
+ "esm2020": "esm2020/util.mjs",
24
+ "fesm2020": "fesm2020/util.mjs",
25
+ "fesm2015": "fesm2015/util.mjs",
26
+ "typings": "index.d.ts",
27
+ "exports": {
28
+ "./package.json": {
29
+ "default": "./package.json"
30
+ },
31
+ ".": {
32
+ "types": "./index.d.ts",
33
+ "esm2020": "./esm2020/util.mjs",
34
+ "es2020": "./fesm2020/util.mjs",
35
+ "es2015": "./fesm2015/util.mjs",
36
+ "node": "./fesm2015/util.mjs",
37
+ "default": "./fesm2020/util.mjs"
38
+ },
39
+ "./convert": {
40
+ "types": "./convert/index.d.ts",
41
+ "esm2020": "./esm2020/convert/utilConvert.mjs",
42
+ "es2020": "./fesm2020/utilConvert.mjs",
43
+ "es2015": "./fesm2015/utilConvert.mjs",
44
+ "node": "./fesm2015/utilConvert.mjs",
45
+ "default": "./fesm2020/utilConvert.mjs"
46
+ }
47
+ },
27
48
  "dependencies": {
28
- "tslib": "^2.2.0"
49
+ "tslib": "^2.3.0"
29
50
  }
30
51
  }
@@ -1,81 +0,0 @@
1
- /**
2
- * @license ng-util(cipchk@qq.com) v12.1.2
3
- * (c) 2020 cipchk https://github.com/ng-util
4
- * License: MIT
5
- */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
8
- typeof define === 'function' && define.amd ? define('@ng-util/util/convert', ['exports'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ng-util'] = global['ng-util'] || {}, global['ng-util'].util = global['ng-util'].util || {}, global['ng-util'].util.convert = {})));
10
- }(this, (function (exports) { 'use strict';
11
-
12
- function propDecoratorFactory(name, fallback, defaultValue) {
13
- function propDecorator(target, propName, originalDescriptor) {
14
- var privatePropName = "$$__" + propName;
15
- if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
16
- console.warn("The prop \"" + privatePropName + "\" is already exist, it will be overrided by " + name + " decorator.");
17
- }
18
- Object.defineProperty(target, privatePropName, {
19
- configurable: true,
20
- writable: true,
21
- });
22
- return {
23
- get: function () {
24
- return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];
25
- },
26
- set: function (value) {
27
- if (originalDescriptor && originalDescriptor.set) {
28
- originalDescriptor.set.bind(this)(fallback(value, defaultValue));
29
- }
30
- this[privatePropName] = fallback(value, defaultValue);
31
- },
32
- };
33
- }
34
- return propDecorator;
35
- }
36
- function toBoolean(value, allowUndefined) {
37
- if (allowUndefined === void 0) { allowUndefined = false; }
38
- return allowUndefined && typeof value === 'undefined' ? undefined : value != null && "" + value !== 'false';
39
- }
40
- /**
41
- * Input decorator that handle a prop to do get/set automatically with toBoolean
42
- *
43
- * ```ts
44
- * @Input() InputBoolean() visible: boolean = false;
45
- * @Input() @InputBoolean(null) visible: boolean = false;
46
- * ```
47
- */
48
- function InputBoolean(defaultValue) {
49
- if (defaultValue === void 0) { defaultValue = false; }
50
- return propDecoratorFactory('InputNumber', toBoolean, defaultValue);
51
- }
52
- function toNumber(value, fallbackValue) {
53
- if (fallbackValue === void 0) { fallbackValue = 0; }
54
- return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
55
- }
56
- /**
57
- * Input decorator that handle a prop to do get/set automatically with toNumber
58
- *
59
- * ```ts
60
- * @Input() @InputNumber() visible: number = 1;
61
- * @Input() @InputNumber(null) visible: number = 2;
62
- * ```
63
- */
64
- function InputNumber(defaultValue) {
65
- if (defaultValue === void 0) { defaultValue = 0; }
66
- return propDecoratorFactory('InputNumber', toNumber, defaultValue);
67
- }
68
-
69
- /**
70
- * Generated bundle index. Do not edit.
71
- */
72
-
73
- exports.InputBoolean = InputBoolean;
74
- exports.InputNumber = InputNumber;
75
- exports.toBoolean = toBoolean;
76
- exports.toNumber = toNumber;
77
-
78
- Object.defineProperty(exports, '__esModule', { value: true });
79
-
80
- })));
81
- //# sourceMappingURL=convert.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert.umd.js","sources":["../../../../packages/util/convert/prop.ts","../../../../packages/util/convert/convert.ts"],"sourcesContent":["function propDecoratorFactory<T, D>(\n name: string,\n fallback: (v: T, defaultValue: D) => D,\n defaultValue: any,\n): (target: any, propName: string) => void {\n function propDecorator(target: any, propName: string, originalDescriptor?: TypedPropertyDescriptor<any>): any {\n const privatePropName = `$$__${propName}`;\n\n if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {\n console.warn(`The prop \"${privatePropName}\" is already exist, it will be overrided by ${name} decorator.`);\n }\n\n Object.defineProperty(target, privatePropName, {\n configurable: true,\n writable: true,\n });\n\n return {\n get(): string {\n return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];\n },\n set(value: T): void {\n if (originalDescriptor && originalDescriptor.set) {\n originalDescriptor.set.bind(this)(fallback(value, defaultValue));\n }\n this[privatePropName] = fallback(value, defaultValue);\n },\n };\n }\n\n return propDecorator;\n}\n\nexport function toBoolean(value: any, allowUndefined: boolean | null = false): boolean | undefined {\n return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false';\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toBoolean\n *\n * ```ts\n * @Input() InputBoolean() visible: boolean = false;\n * @Input() @InputBoolean(null) visible: boolean = false;\n * ```\n */\nexport function InputBoolean(defaultValue: boolean | null = false): any {\n return propDecoratorFactory('InputNumber', toBoolean, defaultValue);\n}\n\nexport function toNumber(value: any): number;\nexport function toNumber<D>(value: any, fallback: D): number | D;\nexport function toNumber(value: any, fallbackValue: number = 0): number {\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toNumber\n *\n * ```ts\n * @Input() @InputNumber() visible: number = 1;\n * @Input() @InputNumber(null) visible: number = 2;\n * ```\n */\nexport function InputNumber(defaultValue: number | null = 0): any {\n return propDecoratorFactory('InputNumber', toNumber, defaultValue);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;IAAA,SAAS,oBAAoB,CAC3B,IAAY,EACZ,QAAsC,EACtC,YAAiB;QAEjB,SAAS,aAAa,CAAC,MAAW,EAAE,QA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AQ,CAAC,KAAU,EAAE,aAAyB;QAAzB,8BAAA,EAAA,iBAAyB;QAC5D,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;IACnG,CAAC;IAED;;;;;;;;aAQgB,WAAW,CAAC,YAA+B;QAA/B,6BAAA,EAAA,gBAA+B;QACzD,OAAO,oBAAoB,CAAC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACrE;;ICjEA;;;;;;;;;;;;;;;"}
@@ -1,28 +0,0 @@
1
- /**
2
- * @license ng-util(cipchk@qq.com) v12.1.2
3
- * (c) 2020 cipchk https://github.com/ng-util
4
- * License: MIT
5
- */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ng-util/util/convert')) :
8
- typeof define === 'function' && define.amd ? define('@ng-util/util', ['exports', '@ng-util/util/convert'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ng-util'] = global['ng-util'] || {}, global['ng-util'].util = {}), global['ng-util'].util.convert));
10
- }(this, (function (exports, convert) { 'use strict';
11
-
12
- /**
13
- * Generated bundle index. Do not edit.
14
- */
15
-
16
- Object.keys(convert).forEach(function (k) {
17
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
18
- enumerable: true,
19
- get: function () {
20
- return convert[k];
21
- }
22
- });
23
- });
24
-
25
- Object.defineProperty(exports, '__esModule', { value: true });
26
-
27
- })));
28
- //# sourceMappingURL=util.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.umd.js","sources":["../../../../packages/util/util.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;CAAA;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"toBoolean":{"__symbolic":"function","parameters":["value","allowUndefined"],"defaults":[null,false],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"reference","name":"allowUndefined"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":34,"character":27,"module":"./prop"},"right":"undefined"}},"thenExpression":{"__symbolic":"reference","name":"undefined"},"elseExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"reference","name":"value"},"right":null},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"value"},"right":"false"}}}},"InputBoolean":{"__symbolic":"function","parameters":["defaultValue"],"defaults":[false],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":0,"character":9,"context":{"name":"propDecoratorFactory"},"module":"./prop"}},"toNumber":{"__symbolic":"function","parameters":["value","fallbackValue"],"defaults":[null,0],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"reference","name":"parseFloat"},"arguments":[{"__symbolic":"reference","name":"value"}]}]}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Number"},"arguments":[{"__symbolic":"reference","name":"value"}]}]}}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Number"},"arguments":[{"__symbolic":"reference","name":"value"}]},"elseExpression":{"__symbolic":"reference","name":"fallbackValue"}}},"InputNumber":{"__symbolic":"function","parameters":["defaultValue"],"defaults":[0],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":0,"character":9,"context":{"name":"propDecoratorFactory"},"module":"./prop"}}},"origins":{"toBoolean":"./prop","InputBoolean":"./prop","toNumber":"./prop","InputNumber":"./prop"},"importAs":"@ng-util/util/convert"}
@@ -1,11 +0,0 @@
1
- {
2
- "main": "../bundles/convert.umd.js",
3
- "module": "../fesm2015/convert.js",
4
- "es2015": "../fesm2015/convert.js",
5
- "esm2015": "../esm2015/convert/convert.js",
6
- "fesm2015": "../fesm2015/convert.js",
7
- "typings": "convert.d.ts",
8
- "metadata": "convert.metadata.json",
9
- "sideEffects": false,
10
- "name": "@ng-util/util/convert"
11
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvY29udmVydC9jb252ZXJ0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert.js","sources":["../../../../packages/util/convert/prop.ts","../../../../packages/util/convert/convert.ts"],"sourcesContent":["function propDecoratorFactory<T, D>(\n name: string,\n fallback: (v: T, defaultValue: D) => D,\n defaultValue: any,\n): (target: any, propName: string) => void {\n function propDecorator(target: any, propName: string, originalDescriptor?: TypedPropertyDescriptor<any>): any {\n const privatePropName = `$$__${propName}`;\n\n if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {\n console.warn(`The prop \"${privatePropName}\" is already exist, it will be overrided by ${name} decorator.`);\n }\n\n Object.defineProperty(target, privatePropName, {\n configurable: true,\n writable: true,\n });\n\n return {\n get(): string {\n return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];\n },\n set(value: T): void {\n if (originalDescriptor && originalDescriptor.set) {\n originalDescriptor.set.bind(this)(fallback(value, defaultValue));\n }\n this[privatePropName] = fallback(value, defaultValue);\n },\n };\n }\n\n return propDecorator;\n}\n\nexport function toBoolean(value: any, allowUndefined: boolean | null = false): boolean | undefined {\n return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false';\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toBoolean\n *\n * ```ts\n * @Input() InputBoolean() visible: boolean = false;\n * @Input() @InputBoolean(null) visible: boolean = false;\n * ```\n */\nexport function InputBoolean(defaultValue: boolean | null = false): any {\n return propDecoratorFactory('InputNumber', toBoolean, defaultValue);\n}\n\nexport function toNumber(value: any): number;\nexport function toNumber<D>(value: any, fallback: D): number | D;\nexport function toNumber(value: any, fallbackValue: number = 0): number {\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toNumber\n *\n * ```ts\n * @Input() @InputNumber() visible: number = 1;\n * @Input() @InputNumber(null) visible: number = 2;\n * ```\n */\nexport function InputNumber(defaultValue: number | null = 0): any {\n return propDecoratorFactory('InputNumber', toNumber, defaultValue);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA,SAAS,oBAAoB,CAC3B,IAAY,EACZ,QAAsC,EACtC,YAAiB;IAEjB,SAAS,aAAa,CAAC,MAAW,EAAE,QAAgB,EAAE,kBAAiD;QACrG,MAAM,eAAe,GAAG,OAAO,QAAQ,EAAE,CAAC;QAE1C,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;YACjE,OAAO,CAAC,IAAI,CAAC,aAAa,eAAe,+CAA+C,IAAI,aAAa,CAAC,CAAC;SAC5G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AC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrE;;ACjEA;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sources":["../../../../packages/util/util.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;"}
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"exports":[{"from":"@ng-util/util/convert"}],"metadata":{},"origins":{},"importAs":"@ng-util/util"}