@pegasimed.com/shared-tools 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-variable-resolvers/pipelines/calculateAge.d.ts +1 -0
- package/dist/custom-variable-resolvers/pipelines/calculateAge.js +9 -0
- package/dist/custom-variable-resolvers/pipelines/calculateAge.js.map +1 -0
- package/dist/custom-variable-resolvers/pipelines/index.d.ts +2 -0
- package/dist/custom-variable-resolvers/pipelines/index.js +2 -0
- package/dist/custom-variable-resolvers/pipelines/index.js.map +1 -1
- package/dist/custom-variable-resolvers/pipelines/toDate.d.ts +3 -0
- package/dist/custom-variable-resolvers/pipelines/toDate.js +12 -0
- package/dist/custom-variable-resolvers/pipelines/toDate.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calculateAge: (birthDate: string) => number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateAge = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
5
|
+
const calculateAge = (birthDate) => {
|
|
6
|
+
return moment().diff(moment(birthDate), 'years');
|
|
7
|
+
};
|
|
8
|
+
exports.calculateAge = calculateAge;
|
|
9
|
+
//# sourceMappingURL=calculateAge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateAge.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/calculateAge.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAE3B,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAU,EAAE;IACxD,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './arrayFilter';
|
|
2
2
|
export * from './arrayJoin';
|
|
3
3
|
export * from './arrayMap';
|
|
4
|
+
export * from './calculateAge';
|
|
4
5
|
export * from './documentSelect';
|
|
5
6
|
export * from './toBoolean';
|
|
7
|
+
export * from './toDate';
|
|
6
8
|
export * from './toLowerCase';
|
|
7
9
|
export * from './toNumber';
|
|
8
10
|
export * from './toReplaceString';
|
|
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./arrayFilter"), exports);
|
|
18
18
|
__exportStar(require("./arrayJoin"), exports);
|
|
19
19
|
__exportStar(require("./arrayMap"), exports);
|
|
20
|
+
__exportStar(require("./calculateAge"), exports);
|
|
20
21
|
__exportStar(require("./documentSelect"), exports);
|
|
21
22
|
__exportStar(require("./toBoolean"), exports);
|
|
23
|
+
__exportStar(require("./toDate"), exports);
|
|
22
24
|
__exportStar(require("./toLowerCase"), exports);
|
|
23
25
|
__exportStar(require("./toNumber"), exports);
|
|
24
26
|
__exportStar(require("./toReplaceString"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,mDAAiC;AACjC,8CAA4B;AAC5B,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,iDAA+B;AAC/B,mDAAiC;AACjC,8CAA4B;AAC5B,2CAAyB;AACzB,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,gDAA8B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type MomentFormat = 'LTS' | 'LT' | 'L' | 'l' | 'LL' | 'll' | 'LLL' | 'lll' | 'LLLL' | 'llll' | 'YYYY-MM-DDTHH:mm:ssZ' | 'YYYY-MM-DD HH:mm:ss' | 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY' | 'MM-DD' | 'MM/DD/YYYY' | 'hh:mm:ss' | 'HH:mm:ss' | 'HH:mm' | 'hh:mm' | 'dd' | 'ddd' | 'dddd' | 'a' | 'A' | 'Z' | 'ZZ' | 'X' | 'x';
|
|
2
|
+
export declare const toDate: (date: string, format?: MomentFormat) => Date | string;
|
|
3
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toDate = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
5
|
+
const toDate = (date, format) => {
|
|
6
|
+
if (!Date.parse(date)) {
|
|
7
|
+
throw new Error('Invalid date');
|
|
8
|
+
}
|
|
9
|
+
return format ? moment(date).format(format || '') : new Date(date);
|
|
10
|
+
};
|
|
11
|
+
exports.toDate = toDate;
|
|
12
|
+
//# sourceMappingURL=toDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toDate.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/toDate.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAkC3B,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,MAAqB,EAAiB,EAAE;IAC3E,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pegasimed.com/shared-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Pegasi shared tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/devops-pegasi/shared-tools#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"moment": "^2.30.1",
|
|
35
36
|
"type-check": "^0.4.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|