reslib 1.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.
- package/README.md +298 -0
- package/build/auth/index.d.ts +2034 -0
- package/build/auth/index.js +5 -0
- package/build/auth/types.d.ts +465 -0
- package/build/auth/types.js +1 -0
- package/build/countries/countries.d.ts +1454 -0
- package/build/countries/countries.js +1 -0
- package/build/countries/index.d.ts +159 -0
- package/build/countries/index.js +5 -0
- package/build/countries/types.d.ts +65 -0
- package/build/countries/types.js +1 -0
- package/build/currency/currencies.d.ts +8 -0
- package/build/currency/currencies.js +1 -0
- package/build/currency/index.d.ts +51 -0
- package/build/currency/index.js +5 -0
- package/build/currency/session.d.ts +23 -0
- package/build/currency/session.js +5 -0
- package/build/currency/types.d.ts +1039 -0
- package/build/currency/types.js +1 -0
- package/build/currency/utils.d.ts +25 -0
- package/build/currency/utils.js +1 -0
- package/build/i18n/index.d.ts +640 -0
- package/build/i18n/index.js +5 -0
- package/build/inputFormatter/index.d.ts +396 -0
- package/build/inputFormatter/index.js +5 -0
- package/build/inputFormatter/types.d.ts +544 -0
- package/build/inputFormatter/types.js +1 -0
- package/build/logger/index.d.ts +235 -0
- package/build/logger/index.js +5 -0
- package/build/observable/index.d.ts +329 -0
- package/build/observable/index.js +1 -0
- package/build/platform/index.d.ts +32 -0
- package/build/platform/index.js +1 -0
- package/build/resources/ResourcePaginationHelper.d.ts +537 -0
- package/build/resources/ResourcePaginationHelper.js +2 -0
- package/build/resources/decorators/create.decorator.d.ts +20 -0
- package/build/resources/decorators/create.decorator.js +1 -0
- package/build/resources/decorators/index.d.ts +41 -0
- package/build/resources/decorators/index.js +1 -0
- package/build/resources/fields/index.d.ts +33 -0
- package/build/resources/fields/index.js +1 -0
- package/build/resources/filters.d.ts +62 -0
- package/build/resources/filters.js +1 -0
- package/build/resources/index.d.ts +854 -0
- package/build/resources/index.js +6 -0
- package/build/resources/types/filters.d.ts +508 -0
- package/build/resources/types/filters.js +1 -0
- package/build/resources/types/index.d.ts +4138 -0
- package/build/resources/types/index.js +1 -0
- package/build/session/index.d.ts +1474 -0
- package/build/session/index.js +1 -0
- package/build/translations/auth.en.d.ts +3 -0
- package/build/translations/auth.en.js +1 -0
- package/build/translations/countries.en.d.ts +6 -0
- package/build/translations/countries.en.js +1 -0
- package/build/translations/currencies.en.d.ts +5 -0
- package/build/translations/currencies.en.js +1 -0
- package/build/translations/date.en.d.ts +19 -0
- package/build/translations/date.en.js +1 -0
- package/build/translations/index.d.ts +1583 -0
- package/build/translations/index.js +5 -0
- package/build/translations/resources.en.d.ts +6 -0
- package/build/translations/resources.en.js +1 -0
- package/build/translations/validator.en.d.ts +104 -0
- package/build/translations/validator.en.js +5 -0
- package/build/types/date.d.ts +44 -0
- package/build/types/date.js +1 -0
- package/build/types/dictionary.d.ts +29 -0
- package/build/types/dictionary.js +1 -0
- package/build/types/i18n.d.ts +121 -0
- package/build/types/i18n.js +1 -0
- package/build/types/index.d.ts +145 -0
- package/build/types/index.js +1 -0
- package/build/utils/areEquals.d.ts +19 -0
- package/build/utils/areEquals.js +1 -0
- package/build/utils/date/dateHelper.d.ts +371 -0
- package/build/utils/date/dateHelper.js +5 -0
- package/build/utils/date/index.d.ts +212 -0
- package/build/utils/date/index.js +5 -0
- package/build/utils/date/isDateObj.d.ts +14 -0
- package/build/utils/date/isDateObj.js +1 -0
- package/build/utils/debounce.d.ts +52 -0
- package/build/utils/debounce.js +1 -0
- package/build/utils/defaultArray.d.ts +18 -0
- package/build/utils/defaultArray.js +1 -0
- package/build/utils/defaultBool.d.ts +14 -0
- package/build/utils/defaultBool.js +1 -0
- package/build/utils/defaultStr.d.ts +17 -0
- package/build/utils/defaultStr.js +1 -0
- package/build/utils/defaultVal.d.ts +18 -0
- package/build/utils/defaultVal.js +1 -0
- package/build/utils/dom/index.d.ts +65 -0
- package/build/utils/dom/index.js +1 -0
- package/build/utils/dom/isDOMElement.d.ts +11 -0
- package/build/utils/dom/isDOMElement.js +1 -0
- package/build/utils/file/index.d.ts +26 -0
- package/build/utils/file/index.js +1 -0
- package/build/utils/global.d.ts +53 -0
- package/build/utils/global.js +1 -0
- package/build/utils/image.d.ts +56 -0
- package/build/utils/image.js +1 -0
- package/build/utils/index.d.ts +39 -0
- package/build/utils/index.js +6 -0
- package/build/utils/interpolate.d.ts +105 -0
- package/build/utils/interpolate.js +1 -0
- package/build/utils/isEmail.d.ts +57 -0
- package/build/utils/isEmail.js +1 -0
- package/build/utils/isEmpty.d.ts +18 -0
- package/build/utils/isEmpty.js +1 -0
- package/build/utils/isNonNullString.d.ts +17 -0
- package/build/utils/isNonNullString.js +1 -0
- package/build/utils/isNullable.d.ts +7 -0
- package/build/utils/isNullable.js +1 -0
- package/build/utils/isNumber.d.ts +36 -0
- package/build/utils/isNumber.js +1 -0
- package/build/utils/isPrimitive.d.ts +16 -0
- package/build/utils/isPrimitive.js +1 -0
- package/build/utils/isPromise.d.ts +14 -0
- package/build/utils/isPromise.js +1 -0
- package/build/utils/isRegex.d.ts +15 -0
- package/build/utils/isRegex.js +1 -0
- package/build/utils/isTime.d.ts +18 -0
- package/build/utils/isTime.js +1 -0
- package/build/utils/json.d.ts +224 -0
- package/build/utils/json.js +1 -0
- package/build/utils/numbers.d.ts +148 -0
- package/build/utils/numbers.js +5 -0
- package/build/utils/object.d.ts +567 -0
- package/build/utils/object.js +1 -0
- package/build/utils/sort.d.ts +67 -0
- package/build/utils/sort.js +1 -0
- package/build/utils/string.d.ts +165 -0
- package/build/utils/string.js +1 -0
- package/build/utils/stringify.d.ts +23 -0
- package/build/utils/stringify.js +1 -0
- package/build/utils/uniqid.d.ts +18 -0
- package/build/utils/uniqid.js +1 -0
- package/build/utils/uri/index.d.ts +333 -0
- package/build/utils/uri/index.js +2 -0
- package/build/validator/index.d.ts +4 -0
- package/build/validator/index.js +6 -0
- package/build/validator/rules/array.d.ts +848 -0
- package/build/validator/rules/array.js +5 -0
- package/build/validator/rules/boolean.d.ts +87 -0
- package/build/validator/rules/boolean.js +5 -0
- package/build/validator/rules/date.d.ts +551 -0
- package/build/validator/rules/date.js +5 -0
- package/build/validator/rules/default.d.ts +367 -0
- package/build/validator/rules/default.js +5 -0
- package/build/validator/rules/enum.d.ts +155 -0
- package/build/validator/rules/enum.js +5 -0
- package/build/validator/rules/file.d.ts +356 -0
- package/build/validator/rules/file.js +5 -0
- package/build/validator/rules/format.d.ts +2825 -0
- package/build/validator/rules/format.js +6 -0
- package/build/validator/rules/index.d.ts +16 -0
- package/build/validator/rules/index.js +6 -0
- package/build/validator/rules/multiRules.d.ts +475 -0
- package/build/validator/rules/multiRules.js +5 -0
- package/build/validator/rules/numeric.d.ts +1135 -0
- package/build/validator/rules/numeric.js +5 -0
- package/build/validator/rules/string.d.ts +504 -0
- package/build/validator/rules/string.js +5 -0
- package/build/validator/rules/target.d.ts +137 -0
- package/build/validator/rules/target.js +5 -0
- package/build/validator/rules/utils.d.ts +1 -0
- package/build/validator/rules/utils.js +1 -0
- package/build/validator/rulesMarkers.d.ts +11 -0
- package/build/validator/rulesMarkers.js +1 -0
- package/build/validator/types.d.ts +2906 -0
- package/build/validator/types.js +1 -0
- package/build/validator/validator.d.ts +3692 -0
- package/build/validator/validator.js +5 -0
- package/lib/cjs/auth.js +1 -0
- package/lib/cjs/countries.js +1 -0
- package/lib/cjs/currency.js +1 -0
- package/lib/cjs/i18n.js +1 -0
- package/lib/cjs/inputFormatter.js +1 -0
- package/lib/cjs/logger.js +1 -0
- package/lib/cjs/observable.js +1 -0
- package/lib/cjs/platform.js +1 -0
- package/lib/cjs/resources.js +1 -0
- package/lib/cjs/session.js +1 -0
- package/lib/cjs/types.js +1 -0
- package/lib/cjs/utils.js +1 -0
- package/lib/cjs/validator.js +1 -0
- package/lib/esm/auth.mjs +1 -0
- package/lib/esm/countries.mjs +1 -0
- package/lib/esm/currency.mjs +1 -0
- package/lib/esm/i18n.mjs +1 -0
- package/lib/esm/inputFormatter.mjs +1 -0
- package/lib/esm/logger.mjs +1 -0
- package/lib/esm/observable.mjs +1 -0
- package/lib/esm/platform.mjs +1 -0
- package/lib/esm/resources.mjs +1 -0
- package/lib/esm/session.mjs +1 -0
- package/lib/esm/types.mjs +1 -0
- package/lib/esm/utils.mjs +1 -0
- package/lib/esm/validator.mjs +1 -0
- package/package.json +244 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided value is empty.
|
|
3
|
+
*
|
|
4
|
+
* A value is considered empty if it is null, undefined, an empty string, or an empty array.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value The value to check.
|
|
7
|
+
* @returns {boolean} True if the value is empty, false otherwise.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* console.log(isEmpty(null)); // Output: true
|
|
11
|
+
* console.log(isEmpty(undefined)); // Output: true
|
|
12
|
+
* console.log(isEmpty('')); // Output: true
|
|
13
|
+
* console.log(isEmpty([])); // Output: true
|
|
14
|
+
* console.log(isEmpty('hello')); // Output: false
|
|
15
|
+
* console.log(isEmpty([1, 2, 3])); // Output: false
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function isEmpty(value: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function n(r){return !!(r==null||typeof r=="undefined"||typeof r=="string"&&r===""||Array.isArray(r)&&!r.length)}exports.isEmpty=n;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided value is a non-empty string.
|
|
3
|
+
*
|
|
4
|
+
* A value is considered a non-empty string if it is not null and is a string.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} val The value to check.
|
|
7
|
+
* @returns {boolean} True if the value is a non-empty string, false otherwise.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* console.log(isNonNullString('hello')); // Output: true
|
|
11
|
+
* console.log(isNonNullString('')); // Output: false
|
|
12
|
+
* console.log(isNonNullString(null)); // Output: false
|
|
13
|
+
* console.log(isNonNullString(undefined)); // Output: false
|
|
14
|
+
* console.log(isNonNullString(123)); // Output: false
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function isNonNullString<T = any>(val: T): val is T & string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function t(n){return !!(n&&typeof n=="string")}exports.isNonNullString=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function t(r){return !!(r==null||typeof r=="number"&&isNaN(r)||typeof r=="string"&&r.trim()==="")}exports.isNullable=t;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided value is a valid finite number, excluding NaN (Not-a-Number)
|
|
3
|
+
* and infinite values (Infinity and -Infinity).
|
|
4
|
+
*
|
|
5
|
+
* This function performs a type check to ensure the value is of type `number` and
|
|
6
|
+
* additionally verifies that it is finite and not NaN, which are special numeric values
|
|
7
|
+
* representing invalid or infinite numbers.
|
|
8
|
+
*
|
|
9
|
+
* It serves as a type guard, narrowing the type of the input value to `number` if the check passes.
|
|
10
|
+
* This is useful in TypeScript for ensuring type safety when dealing with potentially
|
|
11
|
+
* untrusted or dynamically typed inputs, such as user inputs, API responses, or parsed data.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The value to check. Can be of any type, but the function will only return true
|
|
14
|
+
* for actual finite numbers.
|
|
15
|
+
* @returns `true` if the value is a finite number and not NaN; otherwise, `false`.
|
|
16
|
+
* When `true`, TypeScript will narrow the type of `value` to `number`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* console.log(isNumber(42)); // true
|
|
21
|
+
* console.log(isNumber(3.14)); // true
|
|
22
|
+
* console.log(isNumber(NaN)); // false
|
|
23
|
+
* console.log(isNumber(Infinity)); // false
|
|
24
|
+
* console.log(isNumber(-Infinity)); // false
|
|
25
|
+
* console.log(isNumber('42')); // false
|
|
26
|
+
* console.log(isNumber(null)); // false
|
|
27
|
+
* console.log(isNumber(undefined)); // false
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @note This function does not consider numeric strings (e.g., "42") as numbers.
|
|
31
|
+
* For parsing strings to numbers, consider using `parseFloat` or `parseInt`
|
|
32
|
+
* in combination with this check.
|
|
33
|
+
* @note This function rejects infinite values (Infinity/-Infinity) as they typically
|
|
34
|
+
* represent error conditions or overflow in validation contexts.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isNumber(value: any): value is number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function n(i){return typeof i=="number"&&!isNaN(i)&&isFinite(i)}exports.isNumber=n;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Primitive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a value is a primitive type.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} value - The value to check
|
|
6
|
+
* @returns {boolean} True if the value is a primitive, false otherwise
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* isPrimitive("hello") // returns true
|
|
10
|
+
* isPrimitive(42) // returns true
|
|
11
|
+
* isPrimitive(true) // returns true
|
|
12
|
+
* isPrimitive(null) // returns true
|
|
13
|
+
* isPrimitive({}) // returns false
|
|
14
|
+
* isPrimitive([]) // returns false
|
|
15
|
+
*/
|
|
16
|
+
export declare function isPrimitive(value: any): value is Primitive;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function t(i){return i==null||typeof i=="string"||typeof i=="number"||typeof i=="boolean"}exports.isPrimitive=t;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided value is a Promise.
|
|
3
|
+
*
|
|
4
|
+
* A value is considered a Promise if it is a native Promise or if it has a Promise-like interface.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value The value to check.
|
|
7
|
+
* @returns {boolean} True if the value is a Promise, false otherwise.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* console.log(isPromise(Promise.resolve())); // Output: true
|
|
11
|
+
* console.log(isPromise({})); // Output: false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function isPromise(value: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function o(t){return typeof t=="boolean"||!t||typeof t=="number"||typeof t=="string"||typeof t=="symbol"?false:Object(t).constructor===Promise||t.constructor&&(t.constructor.name==="Promise"||t.constructor.name==="AsyncFunction")||t instanceof Promise||typeof(t==null?void 0:t.then)=="function"&&typeof(t==null?void 0:t.catch)=="function"&&typeof(t==null?void 0:t.finally)=="function"?true:t&&typeof t.constructor=="function"&&Function.prototype.toString.call(t.constructor).replace(/\(.*\)/,"()")===Function.prototype.toString.call(Function).replace("Function","Promise").replace(/\(.*\)/,"()")}function n(t){return t&&Object.prototype.toString.call(t)==="[object Promise]"?true:o(t)}exports.isPromise=n;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided value is a regular expression.
|
|
3
|
+
*
|
|
4
|
+
* A value is considered a regular expression if it is an instance of the RegExp constructor, or if it can be converted to a RegExp.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} regExp The value to check.
|
|
7
|
+
* @returns {boolean} True if the value is a regular expression, false otherwise.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* console.log(isRegExp(/hello/)); // Output: true
|
|
11
|
+
* console.log(isRegExp("hello")); // Output: true
|
|
12
|
+
* console.log(isRegExp({})); // Output: false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isRegExp(regExp: any): regExp is RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function n(e){if(e instanceof RegExp)return true;if(!e||typeof e!="object"||!Object.prototype.toString.call(e).includes("RegExp"))return false;try{return new RegExp(e),!0}catch(t){return false}}exports.isRegExp=n;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const timeOptions: {
|
|
2
|
+
readonly hour24: {
|
|
3
|
+
readonly default: RegExp;
|
|
4
|
+
readonly withSeconds: RegExp;
|
|
5
|
+
readonly withOptionalSeconds: RegExp;
|
|
6
|
+
};
|
|
7
|
+
readonly hour12: {
|
|
8
|
+
readonly default: RegExp;
|
|
9
|
+
readonly withSeconds: RegExp;
|
|
10
|
+
readonly withOptionalSeconds: RegExp;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export interface IsTimeOptions {
|
|
14
|
+
format?: keyof typeof timeOptions;
|
|
15
|
+
mode?: 'withSeconds' | 'default' | 'withOptionalSeconds';
|
|
16
|
+
}
|
|
17
|
+
export default function isTime(input: string, options: IsTimeOptions): boolean;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function x(e){return !!(e&&typeof e=="string")}function d(e){return !e||typeof e!="object"?false:e instanceof Date?true:typeof e.getTime!="function"?false:!(Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e.getTime()))}function m(e){return typeof window!="object"||!window||typeof document=="undefined"||typeof HTMLElement=="undefined"||!HTMLElement?false:e===document?true:"HTMLElement"in window?!!e&&e instanceof HTMLElement:!!e&&typeof e=="object"&&e.nodeType===1&&!!e.nodeName}function T(e){return e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function O(e){if(e instanceof RegExp)return true;if(!e||typeof e!="object"||!Object.prototype.toString.call(e).includes("RegExp"))return false;try{return new RegExp(e),!0}catch(n){return false}}function c(e){if(e===null||typeof e!="object"||m(e)||d(e)||O(e)||T(e))return false;let n=Object.getPrototypeOf(e);if(n===null)return true;let t=n.constructor;if(typeof t!="function")return false;if(t===Object)return true;let r=t.prototype;return typeof r!="object"?false:r===Object.prototype?true:typeof n.hasOwnProperty=="function"&&Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")&&typeof n.isPrototypeOf=="function"}function A(e){if(Array.isArray(e)){let r=[];for(var n=0;n<e.length;n++)r[n]=A(e[n]);return r}else if(c(e)&&e){let r={};for(var t in e)e.hasOwnProperty(t)&&(r[t]=A(e[t]));return r}else return e}Object.getSize=function(e,n=false){if(!e||typeof e!="object")return 0;if(Array.isArray(e))return e.length;typeof n!="boolean"&&(n=false);let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&(t++,n===true))return t;return t};function p(e,...n){let t=Array.isArray(e),r=c(e);(e==null||!t&&!r)&&(e={});for(let i=0;i<n.length;i++){let o=n[i];if(o==null)continue;let a=c(o),y=Array.isArray(o);if(!(!a&&!y)){if(t){y&&g(e,o);continue}else if(y)continue;for(let s in o){let f=o[s];if(f==null)continue;if(f===o){e[s]=e;continue}let u=e[s],S=Array.isArray(u),w=Array.isArray(f);if(S){w?g(e[s],f):e[s]=f;continue}else if(!c(u)){e[s]=f;continue}if(w||!c(f)){e[s]=f;continue}e[s]=p({},u,f);}}}return e}var g=(e,n)=>{let t=n.length,r=0;for(let i=0;i<e.length;i++){let o=e[i],a=n[i];if(i<t){let y=Array.isArray(o),s=Array.isArray(a),f=c(o),u=c(a);y&&s||f&&u?(e[r]=p(y?[]:{},o,a),r++):a!=null?(e[r]=a,r++):o!=null&&(e[r]=o,r++);}}for(let i=e.length;i<t;i++)n[i]!==void 0&&n[i]!==null&&e.push(n[i]);return e};function b(e,n){return l(e,"",{},n)}function l(e,n="",t={},r){if(t=c(t)?t:{},T(e)||d(e)||O(e)||Array.isArray(e)&&(r!=null&&r.skipArrays))return n&&(t[n]=e),t;if(typeof e=="function"||typeof e=="object"&&!c(e)&&!N(e))return t;if(e instanceof Map||e instanceof WeakMap)return Array.from(e.entries()).forEach(([i,o])=>{let a=n?`${n}[${String(i)}]`:String(i);l(o,a,t,r);}),t;if(Array.isArray(e)||e instanceof Set||e instanceof WeakSet)return (Array.isArray(e)?e:Array.from(e)).forEach((o,a)=>{let y=n?`${n}[${a}]`:String(a);l(o,y,t,r);}),t;if(c(e))for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let o=e[i],a=n?n.endsWith("]")?`${n}.${i}`:`${n}.${i}`:i;l(o,a,t,r);}return t}function N(e){return Array.isArray(e)||e instanceof Set||e instanceof Map||e instanceof WeakMap||e instanceof WeakSet}function k(e){return Object.entries(e)}Object.typedEntries=k;Object.flatten=b;Object.clone=A;var h={hour24:{default:/^([01]?[0-9]|2[0-3]):([0-5][0-9])$/,withSeconds:/^([01]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/,withOptionalSeconds:/^([01]?[0-9]|2[0-3]):([0-5][0-9])(?::([0-5][0-9]))?$/},hour12:{default:/^(0?[1-9]|1[0-2]):([0-5][0-9]) (A|P)M$/,withSeconds:/^(0?[1-9]|1[0-2]):([0-5][0-9]):([0-5][0-9]) (A|P)M$/,withOptionalSeconds:/^(0?[1-9]|1[0-2]):([0-5][0-9])(?::([0-5][0-9]))? (A|P)M$/}};function M(e,n){var t;return x(e)?(n=p({},{format:"hour24",mode:"default"},n),(!n.format||!h[n.format])&&(n.format="hour24"),(!n.mode||!((t=h[n.format])!=null&&t[n.mode]))&&(n.mode="default"),h[n.format][n.mode].test(e)):false}module.exports=M;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A utility class providing helper methods for JSON manipulation, including
|
|
3
|
+
* handling circular references, stringification, validation, and parsing.
|
|
4
|
+
*
|
|
5
|
+
* This class offers robust JSON operations that go beyond standard JSON methods,
|
|
6
|
+
* particularly useful for complex data structures with circular references or
|
|
7
|
+
* nested JSON strings.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { JsonHelper } from './json';
|
|
12
|
+
*
|
|
13
|
+
* // Handle circular references
|
|
14
|
+
* const circular = { name: 'test' };
|
|
15
|
+
* circular.self = circular;
|
|
16
|
+
* const safe = JsonHelper.decycle(circular);
|
|
17
|
+
* console.log(JsonHelper.stringify(safe)); // '{"name":"test","self":null}'
|
|
18
|
+
*
|
|
19
|
+
* // Validate JSON strings
|
|
20
|
+
* console.log(JsonHelper.isJSON('{"key": "value"}')); // true
|
|
21
|
+
* console.log(JsonHelper.isJSON('not json')); // false
|
|
22
|
+
*
|
|
23
|
+
* // Parse nested JSON
|
|
24
|
+
* const nested = { data: '{"inner": "value"}' };
|
|
25
|
+
* const parsed = JsonHelper.parse(nested);
|
|
26
|
+
* console.log(parsed.data.inner); // 'value'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class JsonHelper {
|
|
30
|
+
/**
|
|
31
|
+
* Removes circular references from an object by replacing them with `null`.
|
|
32
|
+
*
|
|
33
|
+
* This method recursively traverses objects and arrays, detecting when an object
|
|
34
|
+
* references itself (directly or indirectly) and replacing such references with
|
|
35
|
+
* `null` to prevent infinite recursion during JSON serialization.
|
|
36
|
+
*
|
|
37
|
+
* Functions are converted to `undefined` as they cannot be reliably serialized.
|
|
38
|
+
* Primitive values (strings, numbers, booleans) and `null`/`undefined` are returned as-is.
|
|
39
|
+
*
|
|
40
|
+
* @param obj - The object to decycle. Can be any type.
|
|
41
|
+
* @param stack - Internal parameter used for tracking visited objects during recursion.
|
|
42
|
+
* Should not be provided by external callers.
|
|
43
|
+
* @returns A new object with circular references removed, or the original value if it's not an object.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const circular = { name: 'test' };
|
|
48
|
+
* circular.self = circular; // Creates circular reference
|
|
49
|
+
*
|
|
50
|
+
* console.log(JSON.stringify(circular)); // Throws TypeError: Converting circular structure to JSON
|
|
51
|
+
*
|
|
52
|
+
* const decycled = JsonHelper.decycle(circular);
|
|
53
|
+
* console.log(JSON.stringify(decycled)); // '{"name":"test","self":null}'
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const nested = {
|
|
59
|
+
* a: { b: {} },
|
|
60
|
+
* c: {}
|
|
61
|
+
* };
|
|
62
|
+
* nested.a.b = nested.c; // Cross-reference
|
|
63
|
+
* nested.c.ref = nested.a; // Creates cycle
|
|
64
|
+
*
|
|
65
|
+
* const safe = JsonHelper.decycle(nested);
|
|
66
|
+
* console.log(JSON.stringify(safe)); // No circular references
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
static decycle(obj: any, stack?: Array<any>): any;
|
|
70
|
+
/**
|
|
71
|
+
* Converts a JavaScript value to a JSON string, with optional circular reference handling.
|
|
72
|
+
*
|
|
73
|
+
* This method wraps `JSON.stringify()` and provides an option to automatically
|
|
74
|
+
* remove circular references before serialization. If the input is already a string,
|
|
75
|
+
* it is returned as-is.
|
|
76
|
+
*
|
|
77
|
+
* @param jsonObj - The value to convert to a JSON string. Can be any type.
|
|
78
|
+
* @param decylcleVal - Whether to remove circular references before stringification.
|
|
79
|
+
* Defaults to `false` for performance. Set to `true` to handle
|
|
80
|
+
* objects with circular references.
|
|
81
|
+
* @returns A JSON string representation of the input value.
|
|
82
|
+
*
|
|
83
|
+
* @throws Will throw the same errors as `JSON.stringify()` if the value cannot be serialized
|
|
84
|
+
* and `decylcleVal` is `false`, or if circular references cannot be resolved.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* // Basic usage
|
|
89
|
+
* const obj = { name: 'John', age: 30 };
|
|
90
|
+
* console.log(JsonHelper.stringify(obj)); // '{"name":"John","age":30}'
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Handle circular references
|
|
96
|
+
* const circular = { name: 'test' };
|
|
97
|
+
* circular.self = circular;
|
|
98
|
+
*
|
|
99
|
+
* // Without decycling - would throw
|
|
100
|
+
* // console.log(JsonHelper.stringify(circular)); // TypeError
|
|
101
|
+
*
|
|
102
|
+
* // With decycling
|
|
103
|
+
* console.log(JsonHelper.stringify(circular, true)); // '{"name":"test","self":null}'
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* // String input is returned as-is
|
|
109
|
+
* console.log(JsonHelper.stringify('already a string')); // 'already a string'
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
static stringify(jsonObj: any, decylcleVal?: boolean): string;
|
|
113
|
+
/**
|
|
114
|
+
* Determines whether a given value is a valid JSON string representing an object or array.
|
|
115
|
+
*
|
|
116
|
+
* This method performs strict validation, only accepting JSON strings that parse to
|
|
117
|
+
* objects `{}` or arrays `[]`. Primitive JSON values (strings, numbers, booleans, null)
|
|
118
|
+
* are considered invalid for this helper's purposes.
|
|
119
|
+
*
|
|
120
|
+
* The method includes performance optimizations like checking the first character
|
|
121
|
+
* and trimming whitespace before attempting to parse.
|
|
122
|
+
*
|
|
123
|
+
* @param json_string - The value to test. Only strings are considered valid input.
|
|
124
|
+
* @returns `true` if the input is a string containing valid JSON for an object or array,
|
|
125
|
+
* `false` otherwise.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* // Valid JSON objects and arrays
|
|
130
|
+
* console.log(JsonHelper.isJSON('{"key": "value"}')); // true
|
|
131
|
+
* console.log(JsonHelper.isJSON('[1, 2, 3]')); // true
|
|
132
|
+
* console.log(JsonHelper.isJSON('{"nested": {"key": "value"}}')); // true
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* // Invalid inputs
|
|
138
|
+
* console.log(JsonHelper.isJSON('not json')); // false
|
|
139
|
+
* console.log(JsonHelper.isJSON('"string"')); // false (primitive)
|
|
140
|
+
* console.log(JsonHelper.isJSON('42')); // false (primitive)
|
|
141
|
+
* console.log(JsonHelper.isJSON('true')); // false (primitive)
|
|
142
|
+
* console.log(JsonHelper.isJSON('null')); // false (primitive)
|
|
143
|
+
* console.log(JsonHelper.isJSON(123)); // false (not a string)
|
|
144
|
+
* console.log(JsonHelper.isJSON(null)); // false (not a string)
|
|
145
|
+
* console.log(JsonHelper.isJSON('')); // false (empty string)
|
|
146
|
+
* console.log(JsonHelper.isJSON(' ')); // false (whitespace only)
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* // Edge cases
|
|
152
|
+
* console.log(JsonHelper.isJSON('{invalid json')); // false (malformed)
|
|
153
|
+
* console.log(JsonHelper.isJSON('starts with [ but invalid')); // false
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
static isJSON(json_string: any): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Parses JSON strings with support for nested JSON parsing and custom revivers.
|
|
159
|
+
*
|
|
160
|
+
* This method extends `JSON.parse()` by recursively parsing any string properties
|
|
161
|
+
* within objects that contain valid JSON. It's particularly useful for deserializing
|
|
162
|
+
* data structures that have been serialized with nested JSON strings.
|
|
163
|
+
*
|
|
164
|
+
* If the input is not a string, it's returned as-is. If parsing fails, the original
|
|
165
|
+
* input is returned instead of throwing an error.
|
|
166
|
+
*
|
|
167
|
+
* @template T - The expected return type. Defaults to `any`.
|
|
168
|
+
* @param jsonStr - The value to parse. If it's a string, attempts JSON parsing.
|
|
169
|
+
* If it's an object, recursively parses any JSON string properties.
|
|
170
|
+
* @param reviver - An optional function to transform the parsed values, passed to `JSON.parse()`.
|
|
171
|
+
* @returns The parsed value, or the original input if parsing fails or input is not a string.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* // Basic JSON parsing
|
|
176
|
+
* const parsed = JsonHelper.parse('{"name": "John", "age": 30}');
|
|
177
|
+
* console.log(parsed.name); // 'John'
|
|
178
|
+
* console.log(parsed.age); // 30
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* // Parse nested JSON strings within objects
|
|
184
|
+
* const nested = {
|
|
185
|
+
* user: '{"name": "John", "age": 30}',
|
|
186
|
+
* metadata: '{"created": "2023-01-01"}',
|
|
187
|
+
* notes: 'not json'
|
|
188
|
+
* };
|
|
189
|
+
*
|
|
190
|
+
* const parsed = JsonHelper.parse(nested);
|
|
191
|
+
* console.log(parsed.user.name); // 'John'
|
|
192
|
+
* console.log(parsed.metadata.created); // '2023-01-01'
|
|
193
|
+
* console.log(parsed.notes); // 'not json' (unchanged)
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* // Using a reviver function
|
|
199
|
+
* const json = '{"date": "2023-01-01", "count": "42"}';
|
|
200
|
+
* const parsed = JsonHelper.parse(json, (key, value) => {
|
|
201
|
+
* if (key === 'date') return new Date(value);
|
|
202
|
+
* if (key === 'count') return parseInt(value);
|
|
203
|
+
* return value;
|
|
204
|
+
* });
|
|
205
|
+
* console.log(parsed.date instanceof Date); // true
|
|
206
|
+
* console.log(typeof parsed.count); // 'number'
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* // Non-string inputs are returned as-is
|
|
212
|
+
* console.log(JsonHelper.parse(42)); // 42
|
|
213
|
+
* console.log(JsonHelper.parse(null)); // null
|
|
214
|
+
* console.log(JsonHelper.parse({ already: 'parsed' })); // { already: 'parsed' }
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* // Invalid JSON returns original input
|
|
220
|
+
* console.log(JsonHelper.parse('{invalid json}')); // '{invalid json}'
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
static parse<T = any>(jsonStr: any, reviver?: (this: any, key: string, value: any) => any): T;
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var i=class n{static decycle(e,t=[]){if(typeof e=="function")return;if(!e||typeof e!="object")return e;if(t.includes(e))return null;let r=t.concat([e]);return Array.isArray(e)?e.map(a=>n.decycle(a,r)):Object.fromEntries(Object.entries(e).map(([a,c])=>[a,n.decycle(c,r)]))}static stringify(e,t=false){return typeof e=="string"?e:JSON.stringify(t!==false?n.decycle(e):e)}static isJSON(e){if(typeof e!="string")return false;let t=e.trim();if(t.length===0)return false;let r=t[0];if(r!=="{"&&r!=="[")return false;try{let a=JSON.parse(t);return a!==null&&typeof a=="object"}catch(a){return false}}static parse(e,t){if(typeof e=="string")try{e=JSON.parse(e,t);}catch(r){return e}if(e&&typeof e=="object")for(let r in e){let a=e[r];n.isJSON(a)&&(e[r]=n.parse(a,t));}return e}};exports.JsonHelper=i;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Currency, CurrencyFormatters, CurrencySymbol } from '../currency/types';
|
|
2
|
+
/**
|
|
3
|
+
* Extends the Number interface with additional methods for formatting and abbreviating numbers.
|
|
4
|
+
*/
|
|
5
|
+
declare global {
|
|
6
|
+
interface Number extends CurrencyFormatters {
|
|
7
|
+
/**
|
|
8
|
+
* Counts the number of decimal places in the number.
|
|
9
|
+
* @returns {number} The number of decimal places.
|
|
10
|
+
*/
|
|
11
|
+
countDecimals: () => number;
|
|
12
|
+
/**
|
|
13
|
+
* Formats the number as a currency string.
|
|
14
|
+
* @param {Currency | CurrencySymbol} [symbol] The currency symbol to use (optional).
|
|
15
|
+
* @param {number} [decimalDigits] The number of decimal places to display (optional).
|
|
16
|
+
* @param {string} [thousandSeparator] The separator to use for thousands (optional).
|
|
17
|
+
* @param {string} [decimalSeparator] The separator to use for decimals (optional).
|
|
18
|
+
* @param {string} [format] The format to use for the currency string (optional).
|
|
19
|
+
* @returns {string} The formatted currency string.
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* (12).formatMoney(); // Output: "12 FCFA"
|
|
23
|
+
* (12000).formatMoney(); // Output: "12 000 FCFA"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
formatMoney: (symbol?: Currency | CurrencySymbol, decimalDigits?: number, thousandSeparator?: string, decimalSeparator?: string, format?: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats the number using the specified formatter.
|
|
29
|
+
* @param {string} [formatter] The formatter to use (optional).
|
|
30
|
+
* @param {boolean} [abreviate] Whether to abbreviate the number (optional).
|
|
31
|
+
* @returns {string} The formatted string.
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* (12).format("moneyCAD"); // Output: "CA$12"
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
format: (formatter?: string, abreviate?: boolean) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Formats the number as a formatted number string with thousands separators.
|
|
40
|
+
* @param {Currency | number} [optionsOrDecimalDigits] The options or decimal digits to use (optional).
|
|
41
|
+
* @param {string} [thousandSeparator] The separator to use for thousands (optional).
|
|
42
|
+
* @param {string} [decimalSeparator] The separator to use for decimals (optional).
|
|
43
|
+
* @returns {string} The formatted number string.
|
|
44
|
+
*/
|
|
45
|
+
formatNumber: (optionsOrDecimalDigits?: Currency | number, thousandSeparator?: string, decimalSeparator?: string) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Abbreviates the number and formats it as a currency string.
|
|
48
|
+
* @param {Currency | CurrencySymbol} [symbol] The currency symbol to use (optional).
|
|
49
|
+
* @param {number} [decimalDigits] The number of decimal places to display (optional).
|
|
50
|
+
* @param {string} [thousandSeparator] The separator to use for thousands (optional).
|
|
51
|
+
* @param {string} [decimalSeparator] The separator to use for decimals (optional).
|
|
52
|
+
* @param {string} [format] The format to use for the currency string (optional).
|
|
53
|
+
* @returns {string} The formatted and abbreviated currency string.
|
|
54
|
+
*/
|
|
55
|
+
abreviate2FormatMoney: (symbol?: Currency | CurrencySymbol, decimalDigits?: number, thousandSeparator?: string, decimalSeparator?: string, format?: string) => string;
|
|
56
|
+
/***
|
|
57
|
+
* Abbreviates a number and formats it as a number string.
|
|
58
|
+
* @param {number} [decimalDigits] The number of decimal places to display (optional).
|
|
59
|
+
* @param {string} [thousandSeparator] The separator to use for thousands (optional).
|
|
60
|
+
* @param {string} [decimalSeparator] The separator to use for decimals (optional).
|
|
61
|
+
* @returns {string} The formatted and abbreviated number string.
|
|
62
|
+
*/
|
|
63
|
+
abreviate2FormatNumber: (decimalDigits?: number, thousandSeparator?: string, decimalSeparator?: string) => string;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Represents the result of abbreviating a number.
|
|
68
|
+
*/
|
|
69
|
+
export type AbreviateNumberResult = {
|
|
70
|
+
/**
|
|
71
|
+
* The abbreviated result.
|
|
72
|
+
*/
|
|
73
|
+
result: string;
|
|
74
|
+
/**
|
|
75
|
+
* The original value that was abbreviated.
|
|
76
|
+
*/
|
|
77
|
+
value: number;
|
|
78
|
+
/**
|
|
79
|
+
* The format used for abbreviation.
|
|
80
|
+
*/
|
|
81
|
+
format: string;
|
|
82
|
+
/**
|
|
83
|
+
* The suffix used for abbreviation (e.g. "K", "M", etc.).
|
|
84
|
+
*/
|
|
85
|
+
suffix: string;
|
|
86
|
+
/**
|
|
87
|
+
* The formatted value.
|
|
88
|
+
*/
|
|
89
|
+
formattedValue: string;
|
|
90
|
+
/**
|
|
91
|
+
* The minimum number of decimal digits required for a given number when abbreviating it,
|
|
92
|
+
* ensuring that the abbreviated value does not lose significant information compared to the original number.
|
|
93
|
+
*/
|
|
94
|
+
minAbreviationDecimalDigits: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Abbreviates a number to a shorter form (e.g. 1000 -> 1K).
|
|
98
|
+
* @see : https://stackoverflow.com/questions/10599933/convert-long-number-into-abbreviated-string-in-javascript-with-a-special-shortn
|
|
99
|
+
* @param {number} num The number to abbreviate.
|
|
100
|
+
*
|
|
101
|
+
* @param {IAbreviateNumberOptions} [options] Formatting options when returnObject is true.
|
|
102
|
+
* @param {number} num The number to abbreviate.
|
|
103
|
+
* @param {number} [options.decimalDigits] Number of decimal digits to display. If not provided, will use the minimum number required for precision.
|
|
104
|
+
* @param {string} [options.thousandsSeparator] Character to use as thousands separator. Example: "," for 1,234 or " " for 1 234.
|
|
105
|
+
* @param {string} [options.decimalSeparator] Character to use as decimal separator. Example: "." for 1.5 or "," for 1,5.
|
|
106
|
+
* @returns {AbreviateNumberResult} The abbreviated number or an object with additional information.
|
|
107
|
+
*/
|
|
108
|
+
export declare const _abreviateNumber: (num: number, decimalDigits?: number, thousandsSeparator?: string, decimalSeparator?: string) => AbreviateNumberResult;
|
|
109
|
+
/**
|
|
110
|
+
* Abbreviates a number to a shorter form with optional formatting.
|
|
111
|
+
*
|
|
112
|
+
* This function converts a large number into a shorter representation
|
|
113
|
+
* with suffixes such as 'K' for thousands, 'M' for millions, etc.
|
|
114
|
+
* It also allows optional customization of the number of decimal digits
|
|
115
|
+
* and the separators used for thousands and decimals.
|
|
116
|
+
*
|
|
117
|
+
* @param {number} num The number to abbreviate.
|
|
118
|
+
* @param {number} [decimalDigits] Optional number of decimal digits to display.
|
|
119
|
+
* If not provided, the function will use the minimum number required for precision.
|
|
120
|
+
* @param {string} [thousandsSeparator] Optional character to use as thousands separator.
|
|
121
|
+
* Example: ',' for 1,234 or ' ' for 1 234.
|
|
122
|
+
* @param {string} [decimalSeparator] Optional character to use as decimal separator.
|
|
123
|
+
* Example: '.' for 1.5 or ',' for 1,5.
|
|
124
|
+
* @returns {string} The abbreviated number as a string.
|
|
125
|
+
*/
|
|
126
|
+
export declare const abreviateNumber: (num: number, decimalDigits?: number, thousandsSeparator?: string, decimalSeparator?: string) => string;
|
|
127
|
+
/**
|
|
128
|
+
* Abbreviates a number and formats it as a monetary value.
|
|
129
|
+
*
|
|
130
|
+
* @param {number} number The number to abbreviate and format.
|
|
131
|
+
* @param {Currency | CurrencySymbol} [symbol] The currency symbol or name.
|
|
132
|
+
* @param {number} [decimalDigits] The number of decimal digits to use.
|
|
133
|
+
* @param {string} [thousandSeparator] The thousand separator to use.
|
|
134
|
+
* @param {string} [decimalSeparator] The decimal separator to use.
|
|
135
|
+
* @param {string} [format] The format string to use.
|
|
136
|
+
* @returns {string} The abbreviated and formatted monetary value.
|
|
137
|
+
*/
|
|
138
|
+
export declare const abreviate2FormatMoney: (number: number, symbol?: Currency | CurrencySymbol, decimalDigits?: number, thousandSeparator?: string, decimalSeparator?: string, format?: string) => string;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the first non-zero number from a list of arguments, or 0 if no such number exists.
|
|
141
|
+
*
|
|
142
|
+
* This function iterates over the arguments and returns the first one that is a non-zero number.
|
|
143
|
+
* If no such number is found, it returns 0.
|
|
144
|
+
*
|
|
145
|
+
* @param args A list of arguments to check.
|
|
146
|
+
* @returns The first non-zero number, or 0 if no such number exists.
|
|
147
|
+
*/
|
|
148
|
+
export declare function defaultNumber(...args: any[]): number;
|