@pristine-ts/common 0.0.368 → 0.0.369
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/lib/cjs/utils/enum.util.js +14 -0
- package/dist/lib/cjs/utils/enum.util.js.map +1 -0
- package/dist/lib/cjs/utils/utils.js +1 -0
- package/dist/lib/cjs/utils/utils.js.map +1 -1
- package/dist/lib/esm/utils/enum.util.js +10 -0
- package/dist/lib/esm/utils/enum.util.js.map +1 -0
- package/dist/lib/esm/utils/utils.js +1 -0
- package/dist/lib/esm/utils/utils.js.map +1 -1
- package/dist/types/utils/enum.util.d.ts +3 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnumUtil = void 0;
|
|
4
|
+
class EnumUtil {
|
|
5
|
+
static isValidEnumValue(value, enumObject) {
|
|
6
|
+
// Object.values() returns an array of the enum's values.
|
|
7
|
+
// We then use .includes() to see if the provided value is in that array.
|
|
8
|
+
// We cast enumObject to 'any' to satisfy the compiler for a generic check,
|
|
9
|
+
// as the structure of enums is unique.
|
|
10
|
+
return Object.values(enumObject).includes(value);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.EnumUtil = EnumUtil;
|
|
14
|
+
//# sourceMappingURL=enum.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.util.js","sourceRoot":"","sources":["../../../../src/utils/enum.util.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAQ;IACnB,MAAM,CAAC,gBAAgB,CAAmB,KAAU,EAAE,UAAa;QACjE,yDAAyD;QACzD,yEAAyE;QACzE,2EAA2E;QAC3E,uCAAuC;QACvC,OAAO,MAAM,CAAC,MAAM,CAAC,UAAiB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AARD,4BAQC"}
|
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./date.util"), exports);
|
|
18
|
+
__exportStar(require("./enum.util"), exports);
|
|
18
19
|
__exportStar(require("./metadata.util"), exports);
|
|
19
20
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class EnumUtil {
|
|
2
|
+
static isValidEnumValue(value, enumObject) {
|
|
3
|
+
// Object.values() returns an array of the enum's values.
|
|
4
|
+
// We then use .includes() to see if the provided value is in that array.
|
|
5
|
+
// We cast enumObject to 'any' to satisfy the compiler for a generic check,
|
|
6
|
+
// as the structure of enums is unique.
|
|
7
|
+
return Object.values(enumObject).includes(value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=enum.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.util.js","sourceRoot":"","sources":["../../../../src/utils/enum.util.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IACnB,MAAM,CAAC,gBAAgB,CAAmB,KAAU,EAAE,UAAa;QACjE,yDAAyD;QACzD,yEAAyE;QACzE,2EAA2E;QAC3E,uCAAuC;QACvC,OAAO,MAAM,CAAC,MAAM,CAAC,UAAiB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.369",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/common.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/common.module.js",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"src/*.{js,ts}"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "62efc32d9bdba62692c320e0d2db3649aba64ee9"
|
|
62
62
|
}
|