@onivoro/isomorphic-common 0.0.4 → 0.0.6
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/package.json +1 -1
- package/src/index.d.ts +5 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -1
- package/src/lib/constants/millis-per-hour.constant.js +2 -1
- package/src/lib/constants/millis-per-hour.constant.js.map +1 -1
- package/src/lib/constants/millis-per-minute.constant.d.ts +1 -0
- package/src/lib/constants/millis-per-minute.constant.js +5 -0
- package/src/lib/constants/millis-per-minute.constant.js.map +1 -0
- package/src/lib/functions/add-offset.function.d.ts +1 -0
- package/src/lib/functions/add-offset.function.js +15 -0
- package/src/lib/functions/add-offset.function.js.map +1 -0
- package/src/lib/functions/camel-case.function.d.ts +20 -0
- package/src/lib/functions/camel-case.function.js +32 -0
- package/src/lib/functions/camel-case.function.js.map +1 -0
- package/src/lib/functions/get-tag.function.d.ts +1 -0
- package/src/lib/functions/get-tag.function.js +13 -0
- package/src/lib/functions/get-tag.function.js.map +1 -0
- package/src/lib/functions/is-symbol.function.d.ts +1 -0
- package/src/lib/functions/is-symbol.function.js +12 -0
- package/src/lib/functions/is-symbol.function.js.map +1 -0
- package/src/lib/functions/subtract-offset.function.d.ts +1 -0
- package/src/lib/functions/subtract-offset.function.js +15 -0
- package/src/lib/functions/subtract-offset.function.js.map +1 -0
- package/src/lib/functions/to-string.function.d.ts +1 -0
- package/src/lib/functions/to-string.function.js +27 -0
- package/src/lib/functions/to-string.function.js.map +1 -0
- package/src/lib/functions/try-parse-date.function.d.ts +1 -0
- package/src/lib/functions/try-parse-date.function.js +18 -0
- package/src/lib/functions/try-parse-date.function.js.map +1 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
export * from './lib/constants/millis-per-day.constant';
|
|
2
2
|
export * from './lib/constants/millis-per-hour.constant';
|
|
3
|
+
export * from './lib/constants/millis-per-minute.constant';
|
|
4
|
+
export * from './lib/functions/add-offset.function';
|
|
5
|
+
export * from './lib/functions/camel-case.function';
|
|
3
6
|
export * from './lib/functions/convert-object-to-literal.function';
|
|
4
7
|
export * from './lib/functions/from-boolean-string.function';
|
|
5
8
|
export * from './lib/functions/from-csv-string.function';
|
|
6
9
|
export * from './lib/functions/parse-bool.function';
|
|
7
10
|
export * from './lib/functions/sanitize-filename.function';
|
|
8
11
|
export * from './lib/functions/snake-case.function';
|
|
12
|
+
export * from './lib/functions/subtract-offset.function';
|
|
9
13
|
export * from './lib/functions/to-boolean-string.function';
|
|
10
14
|
export * from './lib/functions/to-csv-string.function';
|
|
11
15
|
export * from './lib/functions/to-locale-date-string.function';
|
|
12
16
|
export * from './lib/functions/to-locale-time-string.function';
|
|
13
17
|
export * from './lib/functions/to-unique-array.function';
|
|
18
|
+
export * from './lib/functions/try-parse-date.function';
|
|
14
19
|
export * from './lib/functions/unicode-words.const';
|
|
15
20
|
export * from './lib/functions/upper-first.function';
|
|
16
21
|
export * from './lib/functions/words.function';
|
package/src/index.js
CHANGED
|
@@ -3,17 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./lib/constants/millis-per-day.constant"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./lib/constants/millis-per-hour.constant"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/constants/millis-per-minute.constant"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/functions/add-offset.function"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/functions/camel-case.function"), exports);
|
|
6
9
|
tslib_1.__exportStar(require("./lib/functions/convert-object-to-literal.function"), exports);
|
|
7
10
|
tslib_1.__exportStar(require("./lib/functions/from-boolean-string.function"), exports);
|
|
8
11
|
tslib_1.__exportStar(require("./lib/functions/from-csv-string.function"), exports);
|
|
9
12
|
tslib_1.__exportStar(require("./lib/functions/parse-bool.function"), exports);
|
|
10
13
|
tslib_1.__exportStar(require("./lib/functions/sanitize-filename.function"), exports);
|
|
11
14
|
tslib_1.__exportStar(require("./lib/functions/snake-case.function"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/functions/subtract-offset.function"), exports);
|
|
12
16
|
tslib_1.__exportStar(require("./lib/functions/to-boolean-string.function"), exports);
|
|
13
17
|
tslib_1.__exportStar(require("./lib/functions/to-csv-string.function"), exports);
|
|
14
18
|
tslib_1.__exportStar(require("./lib/functions/to-locale-date-string.function"), exports);
|
|
15
19
|
tslib_1.__exportStar(require("./lib/functions/to-locale-time-string.function"), exports);
|
|
16
20
|
tslib_1.__exportStar(require("./lib/functions/to-unique-array.function"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/functions/try-parse-date.function"), exports);
|
|
17
22
|
tslib_1.__exportStar(require("./lib/functions/unicode-words.const"), exports);
|
|
18
23
|
tslib_1.__exportStar(require("./lib/functions/upper-first.function"), exports);
|
|
19
24
|
tslib_1.__exportStar(require("./lib/functions/words.function"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/isomorphic-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kFAAwD;AACxD,mFAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/isomorphic-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kFAAwD;AACxD,mFAAyD;AACzD,qFAA2D;AAE3D,8EAAoD;AACpD,8EAAoD;AACpD,6FAAmE;AACnE,uFAA6D;AAC7D,mFAAyD;AACzD,8EAAoD;AACpD,qFAA2D;AAC3D,8EAAoD;AACpD,mFAAyD;AACzD,qFAA2D;AAC3D,iFAAuD;AACvD,yFAA+D;AAC/D,yFAA+D;AAC/D,mFAAyD;AACzD,kFAAwD;AACxD,8EAAoD;AACpD,+EAAqD;AACrD,yEAA+C;AAE/C,qFAA2D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MILLIS_PER_HOUR = void 0;
|
|
4
|
-
|
|
4
|
+
const millis_per_minute_constant_1 = require("./millis-per-minute.constant");
|
|
5
|
+
exports.MILLIS_PER_HOUR = millis_per_minute_constant_1.MILLIS_PER_MINUTE * 60;
|
|
5
6
|
//# sourceMappingURL=millis-per-hour.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"millis-per-hour.constant.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/constants/millis-per-hour.constant.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"millis-per-hour.constant.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/constants/millis-per-hour.constant.ts"],"names":[],"mappings":";;;AAAA,6EAAiE;AAEpD,QAAA,eAAe,GAAG,8CAAiB,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MILLIS_PER_MINUTE: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"millis-per-minute.constant.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/constants/millis-per-minute.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addOffset(input: string | Date | undefined | null): Date | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addOffset = void 0;
|
|
4
|
+
const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
|
|
5
|
+
const try_parse_date_function_1 = require("./try-parse-date.function");
|
|
6
|
+
function addOffset(input) {
|
|
7
|
+
const parsed = (0, try_parse_date_function_1.tryParseDate)(input);
|
|
8
|
+
if (!parsed) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const offset = (parsed).getTimezoneOffset();
|
|
12
|
+
return new Date(parsed.valueOf() + offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
|
|
13
|
+
}
|
|
14
|
+
exports.addOffset = addOffset;
|
|
15
|
+
//# sourceMappingURL=add-offset.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-offset.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/add-offset.function.ts"],"names":[],"mappings":";;;AAAA,wFAA4E;AAC5E,uEAAyD;AAEzD,SAAgB,SAAS,CAAC,KAAuC;IAC7D,MAAM,MAAM,GAAG,IAAA,sCAAY,EAAC,KAAK,CAAC,CAAC;IAEnC,IAAG,CAAC,MAAM,EAAE;QACR,OAAO;KACV;IAED,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAE5C,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,8CAAiB,CAAC,CAAC;AACnE,CAAC;AAVD,8BAUC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
3
|
+
*
|
|
4
|
+
* @since 3.0.0
|
|
5
|
+
* @category String
|
|
6
|
+
* @param {string} [string=''] The string to convert.
|
|
7
|
+
* @returns {string} Returns the camel cased string.
|
|
8
|
+
* @see lowerCase, kebabCase, snakeCase, startCase, upperCase, upperFirst
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* camelCase('Foo Bar')
|
|
12
|
+
* // => 'fooBar'
|
|
13
|
+
*
|
|
14
|
+
* camelCase('--foo-bar--')
|
|
15
|
+
* // => 'fooBar'
|
|
16
|
+
*
|
|
17
|
+
* camelCase('__FOO_BAR__')
|
|
18
|
+
* // => 'fooBar'
|
|
19
|
+
*/
|
|
20
|
+
export declare const camelCase: (string: string) => string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://github.com/lodash/lodash/blob/main/src/camelCase.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.camelCase = void 0;
|
|
5
|
+
const to_string_function_1 = require("./to-string.function");
|
|
6
|
+
const upper_first_function_1 = require("./upper-first.function");
|
|
7
|
+
const words_function_1 = require("./words.function");
|
|
8
|
+
/**
|
|
9
|
+
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
10
|
+
*
|
|
11
|
+
* @since 3.0.0
|
|
12
|
+
* @category String
|
|
13
|
+
* @param {string} [string=''] The string to convert.
|
|
14
|
+
* @returns {string} Returns the camel cased string.
|
|
15
|
+
* @see lowerCase, kebabCase, snakeCase, startCase, upperCase, upperFirst
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* camelCase('Foo Bar')
|
|
19
|
+
* // => 'fooBar'
|
|
20
|
+
*
|
|
21
|
+
* camelCase('--foo-bar--')
|
|
22
|
+
* // => 'fooBar'
|
|
23
|
+
*
|
|
24
|
+
* camelCase('__FOO_BAR__')
|
|
25
|
+
* // => 'fooBar'
|
|
26
|
+
*/
|
|
27
|
+
const camelCase = (string) => (0, words_function_1.words)((0, to_string_function_1.toString)(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => {
|
|
28
|
+
word = word.toLowerCase();
|
|
29
|
+
return result + (index ? (0, upper_first_function_1.upperFirst)(word) : word);
|
|
30
|
+
}, '');
|
|
31
|
+
exports.camelCase = camelCase;
|
|
32
|
+
//# sourceMappingURL=camel-case.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camel-case.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/camel-case.function.ts"],"names":[],"mappings":";AAAA,8DAA8D;;;AAE9D,6DAAgD;AAChD,iEAAoD;AACpD,qDAAyC;AAEzC;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE,CAChD,IAAA,sBAAK,EAAC,IAAA,6BAAQ,EAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAc,EAAE,IAAY,EAAE,KAAa,EAAE,EAAE;IACrG,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC1B,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,iCAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC,EAAE,EAAE,CAAC,CAAC;AAJE,QAAA,SAAS,aAIX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTag(value: any): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://github.com/lodash/lodash/blob/main/src/.internal/getTag.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getTag = void 0;
|
|
5
|
+
const toString = Object.prototype.toString;
|
|
6
|
+
function getTag(value) {
|
|
7
|
+
if (value == null) {
|
|
8
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
9
|
+
}
|
|
10
|
+
return toString.call(value);
|
|
11
|
+
}
|
|
12
|
+
exports.getTag = getTag;
|
|
13
|
+
//# sourceMappingURL=get-tag.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tag.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/get-tag.function.ts"],"names":[],"mappings":";AAAA,qEAAqE;;;AAErE,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAA;AAE1C,SAAgB,MAAM,CAAC,KAAU;IAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;QACf,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,eAAe,CAAA;KACtE;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSymbol(value: any): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://github.com/lodash/lodash/blob/main/src/isSymbol.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.isSymbol = void 0;
|
|
5
|
+
const get_tag_function_1 = require("./get-tag.function");
|
|
6
|
+
function isSymbol(value) {
|
|
7
|
+
const type = typeof value;
|
|
8
|
+
return (type === 'symbol' ||
|
|
9
|
+
(type === 'object' && value != null && (0, get_tag_function_1.getTag)(value) === '[object Symbol]'));
|
|
10
|
+
}
|
|
11
|
+
exports.isSymbol = isSymbol;
|
|
12
|
+
//# sourceMappingURL=is-symbol.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-symbol.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/is-symbol.function.ts"],"names":[],"mappings":";AAAA,6DAA6D;;;AAE7D,yDAA4C;AAE5C,SAAgB,QAAQ,CAAC,KAAU;IAC/B,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,OAAO,CACH,IAAI,KAAK,QAAQ;QACjB,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,IAAA,yBAAM,EAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC,CAC9E,CAAC;AACN,CAAC;AAND,4BAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function subtractOffset(input: string | Date | undefined | null): Date | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subtractOffset = void 0;
|
|
4
|
+
const millis_per_minute_constant_1 = require("../constants/millis-per-minute.constant");
|
|
5
|
+
const try_parse_date_function_1 = require("./try-parse-date.function");
|
|
6
|
+
function subtractOffset(input) {
|
|
7
|
+
const parsed = (0, try_parse_date_function_1.tryParseDate)(input);
|
|
8
|
+
if (!parsed) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const offset = (parsed).getTimezoneOffset();
|
|
12
|
+
return new Date(parsed.valueOf() - offset * millis_per_minute_constant_1.MILLIS_PER_MINUTE);
|
|
13
|
+
}
|
|
14
|
+
exports.subtractOffset = subtractOffset;
|
|
15
|
+
//# sourceMappingURL=subtract-offset.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtract-offset.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/subtract-offset.function.ts"],"names":[],"mappings":";;;AAAA,wFAA4E;AAC5E,uEAAyD;AAEzD,SAAgB,cAAc,CAAC,KAAuC;IAClE,MAAM,MAAM,GAAG,IAAA,sCAAY,EAAC,KAAK,CAAC,CAAC;IAEnC,IAAG,CAAC,MAAM,EAAE;QACR,OAAO;KACV;IAED,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAE5C,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,8CAAiB,CAAC,CAAC;AACnE,CAAC;AAVD,wCAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toString(value: any): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://github.com/lodash/lodash/blob/main/src/toString.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.toString = void 0;
|
|
5
|
+
const is_symbol_function_1 = require("./is-symbol.function");
|
|
6
|
+
/** Used as references for various `Number` constants. */
|
|
7
|
+
const INFINITY = 1 / 0;
|
|
8
|
+
function toString(value) {
|
|
9
|
+
if (value == null) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
13
|
+
if (typeof value === 'string') {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
18
|
+
return `${value.map((other) => (other == null ? other : toString(other)))}`;
|
|
19
|
+
}
|
|
20
|
+
if ((0, is_symbol_function_1.isSymbol)(value)) {
|
|
21
|
+
return value.toString();
|
|
22
|
+
}
|
|
23
|
+
const result = `${value}`;
|
|
24
|
+
return result === '0' && 1 / value === -INFINITY ? '-0' : result;
|
|
25
|
+
}
|
|
26
|
+
exports.toString = toString;
|
|
27
|
+
//# sourceMappingURL=to-string.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-string.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/to-string.function.ts"],"names":[],"mappings":";AAAA,6DAA6D;;;AAE7D,6DAAgD;AAEhD,yDAAyD;AACzD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvB,SAAgB,QAAQ,CAAC,KAAU;IAC/B,IAAI,KAAK,IAAI,IAAI,EAAE;QACf,OAAO,EAAE,CAAC;KACb;IACD,0EAA0E;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO,KAAK,CAAC;KAChB;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtB,iEAAiE;QACjE,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/E;IACD,IAAI,IAAA,6BAAQ,EAAC,KAAK,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;KAC3B;IACD,MAAM,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC;IAC1B,OAAO,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACrE,CAAC;AAjBD,4BAiBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryParseDate(input: string | Date | undefined | null): Date | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryParseDate = void 0;
|
|
4
|
+
function tryParseDate(input) {
|
|
5
|
+
if (!input) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (input instanceof Date) {
|
|
9
|
+
return input;
|
|
10
|
+
}
|
|
11
|
+
const date = new Date(input);
|
|
12
|
+
if (date == 'Invalid Date') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return date;
|
|
16
|
+
}
|
|
17
|
+
exports.tryParseDate = tryParseDate;
|
|
18
|
+
//# sourceMappingURL=try-parse-date.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"try-parse-date.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/try-parse-date.function.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,KAAuC;IAChE,IAAI,CAAC,KAAK,EAAE;QACR,OAAO;KACV;IAED,IAAG,KAAK,YAAY,IAAI,EAAE;QACtB,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAK,IAAY,IAAI,cAAc,EAAE;QACjC,OAAO;KACV;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAhBD,oCAgBC"}
|