@powfix/core-js 0.11.8 → 0.11.9
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/src/utils/global/fallbackIfEqual.d.ts +1 -0
- package/dist/src/utils/global/fallbackIfEqual.js +10 -0
- package/dist/src/utils/global/fallbackIfNull.js +2 -1
- package/dist/src/utils/global/fallbackIfUndefined.js +2 -1
- package/dist/src/utils/global/index.d.ts +1 -0
- package/dist/src/utils/global/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fallbackIfEqual<V, C, F>(value: V, condition: C, fallback: F): V | F;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fallbackIfEqual = void 0;
|
|
4
|
+
function fallbackIfEqual(value, condition, fallback) {
|
|
5
|
+
if (typeof value === typeof condition && value === condition) {
|
|
6
|
+
return fallback;
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
exports.fallbackIfEqual = fallbackIfEqual;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fallbackIfNull = void 0;
|
|
4
|
+
const fallbackIfEqual_1 = require("./fallbackIfEqual");
|
|
4
5
|
function fallbackIfNull(value, fallback) {
|
|
5
|
-
return value
|
|
6
|
+
return (0, fallbackIfEqual_1.fallbackIfEqual)(value, null, fallback);
|
|
6
7
|
}
|
|
7
8
|
exports.fallbackIfNull = fallbackIfNull;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fallbackIfUndefined = void 0;
|
|
4
|
+
const fallbackIfEqual_1 = require("./fallbackIfEqual");
|
|
4
5
|
function fallbackIfUndefined(value, fallback) {
|
|
5
|
-
return value
|
|
6
|
+
return (0, fallbackIfEqual_1.fallbackIfEqual)(value, undefined, fallback);
|
|
6
7
|
}
|
|
7
8
|
exports.fallbackIfUndefined = fallbackIfUndefined;
|
|
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./between"), exports);
|
|
18
18
|
__exportStar(require("./sleep"), exports);
|
|
19
|
+
__exportStar(require("./fallbackIfEqual"), exports);
|
|
19
20
|
__exportStar(require("./fallbackIfNull"), exports);
|
|
20
21
|
__exportStar(require("./fallbackIfUndefined"), exports);
|