@dereekb/util 9.16.2 → 9.16.3
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/CHANGELOG.md +4 -0
- package/fetch/CHANGELOG.md +4 -0
- package/fetch/package.json +2 -2
- package/package.json +1 -1
- package/src/lib/value/decision.d.ts +9 -0
- package/src/lib/value/decision.js +18 -1
- package/src/lib/value/decision.js.map +1 -1
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.16.3](https://github.com/dereekb/dbx-components/compare/v9.16.2-dev...v9.16.3) (2022-11-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [9.16.2](https://github.com/dereekb/dbx-components/compare/v9.16.1-dev...v9.16.2) (2022-11-22)
|
|
6
10
|
|
|
7
11
|
|
package/fetch/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.16.3](https://github.com/dereekb/dbx-components/compare/v9.16.2-dev...v9.16.3) (2022-11-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [9.16.2](https://github.com/dereekb/dbx-components/compare/v9.16.1-dev...v9.16.2) (2022-11-22)
|
|
6
10
|
|
|
7
11
|
|
package/fetch/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/fetch",
|
|
3
|
-
"version": "9.16.
|
|
3
|
+
"version": "9.16.3",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"typings": "./src/index.d.ts",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@dereekb/util": "9.16.
|
|
8
|
+
"@dereekb/util": "9.16.3",
|
|
9
9
|
"lodash.isequal": "^4.5.0",
|
|
10
10
|
"make-error": "^1.3.0",
|
|
11
11
|
"class-validator": "^0.13.2",
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FactoryWithRequiredInput } from '../getter/getter';
|
|
2
2
|
import { MapFunction, AsyncMapFunction } from './map';
|
|
3
|
+
import { Maybe } from './maybe.type';
|
|
3
4
|
/**
|
|
4
5
|
* A map function that derives a boolean from the input.
|
|
5
6
|
*/
|
|
@@ -14,3 +15,11 @@ export declare type DecisionFunctionFactory<C, I> = FactoryWithRequiredInput<Dec
|
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
17
|
export declare function invertDecision<T = unknown, F extends DecisionFunction<T> = DecisionFunction<T>>(decisionFn: F, invert?: boolean): F;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a DecisionFunction from the input.
|
|
20
|
+
*
|
|
21
|
+
* @param valueOrFunction
|
|
22
|
+
* @param defaultIfUndefined
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function asDecisionFunction<T = unknown>(valueOrFunction: Maybe<boolean | DecisionFunction<T>>, defaultIfUndefined?: boolean): DecisionFunction<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invertDecision = void 0;
|
|
3
|
+
exports.asDecisionFunction = exports.invertDecision = void 0;
|
|
4
4
|
const filter_1 = require("../filter/filter");
|
|
5
5
|
/**
|
|
6
6
|
* Used to invert a decision function by returning the opposite of what it returns.
|
|
@@ -13,4 +13,21 @@ function invertDecision(decisionFn, invert = true) {
|
|
|
13
13
|
return (0, filter_1.invertFilter)(decisionFn, invert);
|
|
14
14
|
}
|
|
15
15
|
exports.invertDecision = invertDecision;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a DecisionFunction from the input.
|
|
18
|
+
*
|
|
19
|
+
* @param valueOrFunction
|
|
20
|
+
* @param defaultIfUndefined
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function asDecisionFunction(valueOrFunction, defaultIfUndefined = true) {
|
|
24
|
+
const input = valueOrFunction !== null && valueOrFunction !== void 0 ? valueOrFunction : defaultIfUndefined;
|
|
25
|
+
if (typeof input === 'boolean') {
|
|
26
|
+
return () => input;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return input;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.asDecisionFunction = asDecisionFunction;
|
|
16
33
|
//# sourceMappingURL=decision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/decision.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;
|
|
1
|
+
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/decision.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAahE;;;;;;GAMG;AACH,SAAgB,cAAc,CAAmE,UAAa,EAAE,MAAM,GAAG,IAAI;IAC3H,OAAO,IAAA,qBAAY,EAAC,UAA4B,EAAE,MAAM,CAAM,CAAC;AACjE,CAAC;AAFD,wCAEC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAc,eAAqD,EAAE,kBAAkB,GAAG,IAAI;IAC9H,MAAM,KAAK,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,kBAAkB,CAAC;IAEpD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QAC9B,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;KACpB;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AARD,gDAQC"}
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.16.3](https://github.com/dereekb/dbx-components/compare/v9.16.2-dev...v9.16.3) (2022-11-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [9.16.2](https://github.com/dereekb/dbx-components/compare/v9.16.1-dev...v9.16.2) (2022-11-22)
|
|
6
10
|
|
|
7
11
|
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/test",
|
|
3
|
-
"version": "9.16.
|
|
3
|
+
"version": "9.16.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util": "9.16.
|
|
9
|
+
"@dereekb/util": "9.16.3",
|
|
10
10
|
"lodash.isequal": "^4.5.0",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
12
|
"class-validator": "^0.13.2",
|