@briza/illogical 1.7.1 → 1.7.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 +8 -0
- package/lib/illogical.esm.js +11 -534
- package/lib/illogical.js +11 -534
- package/package.json +32 -25
- package/readme.md +0 -13
- package/types/common/evaluable.d.ts +6 -4
- package/types/expression/logical/index.d.ts +1 -1
- package/types/index.d.ts +6 -5
- package/types/operand/index.d.ts +1 -1
- package/types/operand/reference.d.ts +2 -1
- package/types/unsafe/simplify.d.ts +1 -1
|
@@ -35,13 +35,15 @@ export interface Evaluable {
|
|
|
35
35
|
* Simplifies this Evaluable when possible.
|
|
36
36
|
*
|
|
37
37
|
* @param {Context} ctx context for the evaluation
|
|
38
|
-
* @param {string[]} strictKeys keys to be considered present even if they are not present in the
|
|
39
|
-
*
|
|
38
|
+
* @param {string[] | Set<string>} strictKeys keys to be considered present even if they are not present in the
|
|
39
|
+
* context. Passing as a Set is recommended for performance reasons.
|
|
40
|
+
* @param {string[] | Set<string>} optionalKeys keys to be considered not present unless they are in the context or in
|
|
40
41
|
* `strictKeys`; when `strictKeys` is `undefined` and `optionalKeys` is an array, every key that is not in
|
|
41
|
-
* `optionalKeys` is considered to be present and thus will be evaluated
|
|
42
|
+
* `optionalKeys` is considered to be present and thus will be evaluated. Passing as a Set is recommended for
|
|
43
|
+
* performance reasons.
|
|
42
44
|
* @returns {Result | Evaluable} simplified value or itself
|
|
43
45
|
*/
|
|
44
|
-
simplify(ctx: Context, strictKeys?: string[]
|
|
46
|
+
simplify(ctx: Context, strictKeys?: string[] | Set<string>, optionalKeys?: string[] | Set<string>): Result | Evaluable;
|
|
45
47
|
/**
|
|
46
48
|
* Serializes the Evaluable to its input format.
|
|
47
49
|
*
|
|
@@ -22,7 +22,7 @@ export declare abstract class Logical implements Evaluable {
|
|
|
22
22
|
/**
|
|
23
23
|
* {@link Evaluable.simplify}
|
|
24
24
|
*/
|
|
25
|
-
abstract simplify(ctx: Context, strictKeys?: string[]
|
|
25
|
+
abstract simplify(ctx: Context, strictKeys?: string[] | Set<string>, optionalKeys?: string[] | Set<string>): Result | Evaluable;
|
|
26
26
|
/**
|
|
27
27
|
* Get the strict representation of the expression.
|
|
28
28
|
* @return {string}
|
package/types/index.d.ts
CHANGED
|
@@ -68,13 +68,14 @@ declare class Engine {
|
|
|
68
68
|
*
|
|
69
69
|
* @param {ExpressionInput} exp Raw expression.
|
|
70
70
|
* @param {Context} context Evaluation data context.
|
|
71
|
-
* @param {string[]} strictKeys keys to be considered present even if they are not present in the
|
|
72
|
-
*
|
|
71
|
+
* @param {string[] | Set<string>} strictKeys keys to be considered present even if they are not present in the
|
|
72
|
+
* context. Passing as a Set is recommended for performance reasons.
|
|
73
|
+
* @param {string[] | Set<string>} optionalKeys keys to be considered not present unless they are in the context or in
|
|
73
74
|
* `strictKeys`; when `strictKeys` is `undefined` and `optionalKeys` is an array, every key that is not in
|
|
74
|
-
* `optionalKeys` is considered to be present and thus will be evaluated
|
|
75
|
+
* `optionalKeys` is considered to be present and thus will be evaluated. Passing as a Set is recommended for
|
|
76
|
+
* performance reasons.
|
|
75
77
|
* @returns {Inpunt | boolean}
|
|
76
78
|
*/
|
|
77
|
-
simplify(exp: ExpressionInput, context: Context, strictKeys?: string[]
|
|
78
|
-
unsafeSimplify(exp: ExpressionInput, context: Context, strictKeys?: string[], optionalKeys?: string[]): Input | boolean;
|
|
79
|
+
simplify(exp: ExpressionInput, context: Context, strictKeys?: string[] | Set<string>, optionalKeys?: string[] | Set<string>): Input | boolean;
|
|
79
80
|
}
|
|
80
81
|
export default Engine;
|
package/types/operand/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare abstract class Operand implements Evaluable {
|
|
|
13
13
|
/**
|
|
14
14
|
* {@link Evaluable.simplify}
|
|
15
15
|
*/
|
|
16
|
-
abstract simplify(ctx: Context, strictKeys?: string[]
|
|
16
|
+
abstract simplify(ctx: Context, strictKeys?: string[] | Set<string>, optionalKeys?: string[] | Set<string>): Result | Evaluable;
|
|
17
17
|
/**
|
|
18
18
|
* {@link Evaluable.serialize}
|
|
19
19
|
*/
|
|
@@ -24,10 +24,11 @@ export declare class Reference extends Operand {
|
|
|
24
24
|
* @return {boolean}
|
|
25
25
|
*/
|
|
26
26
|
evaluate(ctx: Context): Result;
|
|
27
|
+
private checkStrictAndOptional;
|
|
27
28
|
/**
|
|
28
29
|
* {@link Evaluable.simplify}
|
|
29
30
|
*/
|
|
30
|
-
simplify(ctx: Context, strictKeys?: string[]
|
|
31
|
+
simplify(ctx: Context, strictKeys?: string[] | Set<string>, optionalKeys?: string[] | Set<string>): Result | Evaluable;
|
|
31
32
|
/**
|
|
32
33
|
* {@link Evaluable.serialize}
|
|
33
34
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Context, Evaluable } from '../common/evaluable';
|
|
2
2
|
import { Input } from '../parser';
|
|
3
3
|
import { Options } from '../parser/options';
|
|
4
|
-
export declare const unsafeSimplify: (context: Context, opts: Options, strictKeys?: string
|
|
4
|
+
export declare const unsafeSimplify: (context: Context, opts: Options, strictKeys?: Set<string>, optionalKeys?: Set<string>) => (input: Input) => Input | Evaluable;
|