@degenerate/rules 0.0.3 → 0.0.5
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/evaluation/conditions/starts-end-with-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/starts-end-with-conditions.d.ts.map +1 -1
- package/dist/evaluation/conditions/starts-end-with-conditions.js +19 -0
- package/dist/evaluation/index.d.ts +9 -0
- package/dist/evaluation/index.d.ts.map +1 -1
- package/dist/evaluation/index.js +9 -0
- package/package.json +1 -1
|
@@ -11,6 +11,6 @@ import { ConditionTypeStartsEndsWith } from '@degenerate/generic';
|
|
|
11
11
|
*
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string |
|
|
14
|
+
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string | number, conditionType: ConditionTypeStartsEndsWith) => boolean;
|
|
15
15
|
export { isValidStartEndWithValue };
|
|
16
16
|
//# sourceMappingURL=starts-end-with-conditions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starts-end-with-conditions.d.ts","sourceRoot":"","sources":["../../../src/evaluation/conditions/starts-end-with-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"starts-end-with-conditions.d.ts","sourceRoot":"","sources":["../../../src/evaluation/conditions/starts-end-with-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2BAA2B,EAAiB,MAAM,qBAAqB,CAAC;AAEjF;;;;;;;;GAQG;AACH,QAAA,MAAM,wBAAwB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,MAAM,iBAC1E,2BAA2B,KAAG,OAWhD,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -15,6 +15,10 @@ const generic_1 = require("@degenerate/generic");
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
const isValidStartEndWithValue = (dataValue, conditionValue, conditionType) => {
|
|
18
|
+
// Make sure the data type is correct
|
|
19
|
+
// if (!dataValue) SafeRuleEvaluationConditionDataValueError()
|
|
20
|
+
// Array.isArray(incomingObject)
|
|
21
|
+
// const isArray = validateArray
|
|
18
22
|
switch (conditionType) {
|
|
19
23
|
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
20
24
|
return dataValue.toString().startsWith(conditionValue.toString());
|
|
@@ -23,3 +27,18 @@ const isValidStartEndWithValue = (dataValue, conditionValue, conditionType) => {
|
|
|
23
27
|
}
|
|
24
28
|
};
|
|
25
29
|
exports.isValidStartEndWithValue = isValidStartEndWithValue;
|
|
30
|
+
/**
|
|
31
|
+
* This takes a value and checks if the value starts or ends with value for a string or number
|
|
32
|
+
* @param dataValue the value to check
|
|
33
|
+
* @param conditionValue the value to check against
|
|
34
|
+
* @param conditionType the type of equality condition to check for
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
const isValidStartEndWithStringNumberValue = (dataValue, conditionValue, conditionType) => {
|
|
38
|
+
switch (conditionType) {
|
|
39
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
40
|
+
return dataValue.toString().startsWith(conditionValue.toString());
|
|
41
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
42
|
+
return dataValue.toString().endsWith(conditionValue.toString());
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -7,4 +7,13 @@ export * from './conditions/range-conditions';
|
|
|
7
7
|
export * from './conditions/special-conditions';
|
|
8
8
|
export * from './conditions/starts-end-with-conditions';
|
|
9
9
|
export * from './conditions/typeof-rule-conditions';
|
|
10
|
+
export * from './check-function-integrity';
|
|
11
|
+
export * from './check-if-proposal-is-valid';
|
|
12
|
+
export * from './determine-if-data-has-changed';
|
|
13
|
+
export * from './evaluate-rule';
|
|
14
|
+
export * from './evaluate-rule-conditions';
|
|
15
|
+
export * from './evaluate-rules';
|
|
16
|
+
export * from './get-data-changed-information';
|
|
17
|
+
export * from './get-root-property-results';
|
|
18
|
+
export * from './start-rule-evaluation';
|
|
10
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluation/index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluation/index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AAIpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
package/dist/evaluation/index.js
CHANGED
|
@@ -25,3 +25,12 @@ __exportStar(require("./conditions/special-conditions"), exports);
|
|
|
25
25
|
__exportStar(require("./conditions/starts-end-with-conditions"), exports);
|
|
26
26
|
__exportStar(require("./conditions/typeof-rule-conditions"), exports);
|
|
27
27
|
//#endregion Conditional Functions
|
|
28
|
+
__exportStar(require("./check-function-integrity"), exports);
|
|
29
|
+
__exportStar(require("./check-if-proposal-is-valid"), exports);
|
|
30
|
+
__exportStar(require("./determine-if-data-has-changed"), exports);
|
|
31
|
+
__exportStar(require("./evaluate-rule"), exports);
|
|
32
|
+
__exportStar(require("./evaluate-rule-conditions"), exports);
|
|
33
|
+
__exportStar(require("./evaluate-rules"), exports);
|
|
34
|
+
__exportStar(require("./get-data-changed-information"), exports);
|
|
35
|
+
__exportStar(require("./get-root-property-results"), exports);
|
|
36
|
+
__exportStar(require("./start-rule-evaluation"), exports);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/rules",
|
|
3
3
|
"description": "This contains the rules information needed for the ShareData Adaptive Framework Ecosystem (SAFE) network.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"devDependencies": {
|