jexp 0.2.2 → 0.2.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.
@@ -4,5 +4,5 @@ export declare class ExpressionConstraintBuilder implements IConstraintBuilder {
4
4
  private expressions;
5
5
  constructor(expressions: Expressions);
6
6
  apply(rule: Schema): boolean;
7
- build(schema: Schema, rule: Schema): Promise<IConstraint>;
7
+ build(schema: Schema, rule: Schema): IConstraint;
8
8
  }
package/manager/schema.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ExpressionConstraintBuilder = void 0;
13
4
  const jemv_1 = require("jemv");
@@ -19,16 +10,14 @@ class ExpressionConstraintBuilder {
19
10
  return rule.expression !== undefined;
20
11
  }
21
12
  build(schema, rule) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const _rule = rule;
24
- if (_rule.expression === undefined) {
25
- throw new Error('Expression not define');
26
- }
27
- const expression = _rule.expression;
28
- return new jemv_1.FunctionConstraint((value, path) => __awaiter(this, void 0, void 0, function* () {
29
- const result = this.expressions.eval(expression, value);
30
- return result ? [] : [{ path: path, message: `does not meet the expression ${expression}` }];
31
- }));
13
+ const _rule = rule;
14
+ if (_rule.expression === undefined) {
15
+ throw new Error('Expression not define');
16
+ }
17
+ const expression = _rule.expression;
18
+ return new jemv_1.FunctionConstraint((value, path) => {
19
+ const result = this.expressions.eval(expression, value);
20
+ return result ? [] : [{ path: path, message: `does not meet the expression ${expression}` }];
32
21
  });
33
22
  }
34
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/lib/manager/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA6F;AAG7F,MAAa,2BAA2B;IAEvC,YAAa,WAAwB;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAC/B,CAAC;IAEM,KAAK,CAAE,IAAY;QACzB,OAAQ,IAAyB,CAAC,UAAU,KAAK,SAAS,CAAA;IAC3D,CAAC;IAEY,KAAK,CAAE,MAAa,EAAE,IAAY;;YAC9C,MAAM,KAAK,GAAG,IAAwB,CAAA;YACtC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;gBACnC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;aACxC;YACD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;YACnC,OAAO,IAAI,yBAAkB,CAC5B,CAAO,KAAS,EAAE,IAAW,EAAyB,EAAE;gBACvD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;gBACvD,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gCAAgC,UAAU,EAAE,EAAE,CAAC,CAAA;YAC7F,CAAC,CAAA,CACD,CAAA;QACF,CAAC;KAAA;CACD;AAvBD,kEAuBC"}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/lib/manager/schema.ts"],"names":[],"mappings":";;;AAAA,+BAA6F;AAG7F,MAAa,2BAA2B;IAEvC,YAAa,WAAwB;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAC/B,CAAC;IAEM,KAAK,CAAE,IAAY;QACzB,OAAQ,IAAyB,CAAC,UAAU,KAAK,SAAS,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAE,MAAa,EAAE,IAAY;QACxC,MAAM,KAAK,GAAG,IAAwB,CAAA;QACtC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;SACxC;QACD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;QACnC,OAAO,IAAI,yBAAkB,CAC5B,CAAC,KAAS,EAAE,IAAW,EAAgB,EAAE;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;YACvD,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gCAAgC,UAAU,EAAE,EAAE,CAAC,CAAA;QAC7F,CAAC,CACD,CAAA;IACF,CAAC;CACD;AAvBD,kEAuBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jexp",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Parser and evaluator of expressions by line of commands. The expressions correspond to the package js-expressions",
5
5
  "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",
6
6
  "license": "Apache-2.0 License",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "commander": "^9.4.0",
21
- "jemv": "0.1.2",
22
- "js-expressions": "1.1.11",
21
+ "jemv": "0.1.4",
22
+ "js-expressions": "1.1.12",
23
23
  "js-yaml": "^4.1.0",
24
24
  "crypto-js": "^4.1.1"
25
25
  },