@ng-util/util 19.0.0 → 19.0.1

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.
@@ -6,18 +6,20 @@ function propDecoratorFactory(name, fallback, defaultValue) {
6
6
  }
7
7
  Object.defineProperty(target, privatePropName, {
8
8
  configurable: true,
9
- writable: true,
9
+ writable: true
10
10
  });
11
11
  return {
12
12
  get() {
13
- return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName];
13
+ return originalDescriptor && originalDescriptor.get
14
+ ? originalDescriptor.get.bind(this)()
15
+ : this[privatePropName];
14
16
  },
15
17
  set(value) {
16
18
  if (originalDescriptor && originalDescriptor.set) {
17
19
  originalDescriptor.set.bind(this)(fallback(value, defaultValue));
18
20
  }
19
21
  this[privatePropName] = fallback(value, defaultValue);
20
- },
22
+ }
21
23
  };
22
24
  }
23
25
  return propDecorator;
@@ -1 +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\n/**\n * @deprecated use `booleanAttribute` instead\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 * @deprecated use `booleanAttribute` instead\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\n/**\n * @deprecated use `numberAttribute` instead\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 * @deprecated use `numberAttribute` instead\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,QAAA,MAAM,eAAe,GAAG,CAAO,IAAA,EAAA,QAAQ,EAAE;AAEzC,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;YACjE,OAAO,CAAC,IAAI,CAAC,CAAA,UAAA,EAAa,eAAe,CAA+C,4CAAA,EAAA,IAAI,CAAa,WAAA,CAAA,CAAC;;AAG5G,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,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,CAAC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC;AACpE;;ACzEA;;AAEG;;;;"}
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\n ? originalDescriptor.get.bind(this)()\n : 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\n/**\n * @deprecated use `booleanAttribute` instead\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 * @deprecated use `booleanAttribute` instead\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\n/**\n * @deprecated use `numberAttribute` instead\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 * @deprecated use `numberAttribute` instead\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,QAAA,MAAM,eAAe,GAAG,CAAO,IAAA,EAAA,QAAQ,EAAE;AAEzC,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;YACjE,OAAO,CAAC,IAAI,CAAC,CAAA,UAAA,EAAa,eAAe,CAA+C,4CAAA,EAAA,IAAI,CAAa,WAAA,CAAA,CAAC;;AAG5G,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE;AAC7C,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,QAAQ,EAAE;AACX,SAAA,CAAC;QAEF,OAAO;YACL,GAAG,GAAA;AACD,gBAAA,OAAO,kBAAkB,IAAI,kBAAkB,CAAC;sBAC5C,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;AACnC,sBAAE,IAAI,CAAC,eAAe,CAAC;aAC1B;AACD,YAAA,GAAG,CAAC,KAAQ,EAAA;AACV,gBAAA,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,GAAG,EAAE;AAChD,oBAAA,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;;gBAElE,IAAI,CAAC,eAAe,CAAC,GAAG,QAAQ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