rado 0.4.1 → 0.4.2
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/define/Expr.d.ts +6 -5
- package/dist/define/Expr.js +23 -13
- package/dist/define/Ops.js +4 -4
- package/package.json +1 -1
package/dist/define/Expr.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ export declare namespace ExprData {
|
|
|
112
112
|
constructor(target: Target, condition: ExprData);
|
|
113
113
|
}
|
|
114
114
|
function create(input: any): ExprData;
|
|
115
|
+
function createAll(...inputs: Array<any>): Array<ExprData>;
|
|
115
116
|
}
|
|
116
117
|
/** Expression or value of type T */
|
|
117
118
|
export type EV<T> = Expr<T> | T;
|
|
@@ -137,12 +138,12 @@ export declare class Expr<T> {
|
|
|
137
138
|
isGreaterOrEqual(that: EV<any>): Expr<boolean>;
|
|
138
139
|
isLess(that: EV<any>): Expr<boolean>;
|
|
139
140
|
isLessOrEqual(that: EV<any>): Expr<boolean>;
|
|
140
|
-
add(this: Expr<number>, that: EV<number
|
|
141
|
-
subtract(this: Expr<number>, that: EV<number
|
|
142
|
-
multiply(this: Expr<number>, that: EV<number
|
|
141
|
+
add(this: Expr<number>, that: EV<number>, ...rest: Array<EV<number>>): Expr<number>;
|
|
142
|
+
subtract(this: Expr<number>, that: EV<number>, ...rest: Array<EV<number>>): Expr<number>;
|
|
143
|
+
multiply(this: Expr<number>, that: EV<number>, ...rest: Array<EV<number>>): Expr<number>;
|
|
143
144
|
remainder(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
144
|
-
divide(this: Expr<number>, that: EV<number
|
|
145
|
-
concat(this: Expr<string>, that: EV<string
|
|
145
|
+
divide(this: Expr<number>, that: EV<number>, ...rest: Array<EV<number>>): Expr<number>;
|
|
146
|
+
concat(this: Expr<string>, that: EV<string>, ...rest: Array<EV<string>>): Expr<string>;
|
|
146
147
|
like(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
|
147
148
|
glob(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
|
148
149
|
match(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
package/dist/define/Expr.js
CHANGED
|
@@ -147,6 +147,10 @@ var ExprData;
|
|
|
147
147
|
return new ExprData2.Param(new ParamData.Value(input));
|
|
148
148
|
}
|
|
149
149
|
ExprData2.create = create;
|
|
150
|
+
function createAll(...inputs) {
|
|
151
|
+
return inputs.map(create);
|
|
152
|
+
}
|
|
153
|
+
ExprData2.createAll = createAll;
|
|
150
154
|
})(ExprData || (ExprData = {}));
|
|
151
155
|
class Expr {
|
|
152
156
|
constructor(expr) {
|
|
@@ -273,19 +277,25 @@ class Expr {
|
|
|
273
277
|
)
|
|
274
278
|
);
|
|
275
279
|
}
|
|
276
|
-
add(that) {
|
|
280
|
+
add(that, ...rest) {
|
|
277
281
|
return new Expr(
|
|
278
|
-
|
|
282
|
+
ExprData.createAll(this, that, ...rest).reduce(
|
|
283
|
+
(a, b) => new ExprData.BinOp("Add" /* Add */, a, b)
|
|
284
|
+
)
|
|
279
285
|
);
|
|
280
286
|
}
|
|
281
|
-
subtract(that) {
|
|
287
|
+
subtract(that, ...rest) {
|
|
282
288
|
return new Expr(
|
|
283
|
-
|
|
289
|
+
ExprData.createAll(this, that, ...rest).reduce(
|
|
290
|
+
(a, b) => new ExprData.BinOp("Subt" /* Subt */, a, b)
|
|
291
|
+
)
|
|
284
292
|
);
|
|
285
293
|
}
|
|
286
|
-
multiply(that) {
|
|
294
|
+
multiply(that, ...rest) {
|
|
287
295
|
return new Expr(
|
|
288
|
-
|
|
296
|
+
ExprData.createAll(this, that, ...rest).reduce(
|
|
297
|
+
(a, b) => new ExprData.BinOp("Mult" /* Mult */, a, b)
|
|
298
|
+
)
|
|
289
299
|
);
|
|
290
300
|
}
|
|
291
301
|
remainder(that) {
|
|
@@ -293,17 +303,17 @@ class Expr {
|
|
|
293
303
|
new ExprData.BinOp("Mod" /* Mod */, this[Expr.Data], ExprData.create(that))
|
|
294
304
|
);
|
|
295
305
|
}
|
|
296
|
-
divide(that) {
|
|
306
|
+
divide(that, ...rest) {
|
|
297
307
|
return new Expr(
|
|
298
|
-
|
|
308
|
+
ExprData.createAll(this, that, ...rest).reduce(
|
|
309
|
+
(a, b) => new ExprData.BinOp("Div" /* Div */, a, b)
|
|
310
|
+
)
|
|
299
311
|
);
|
|
300
312
|
}
|
|
301
|
-
concat(that) {
|
|
313
|
+
concat(that, ...rest) {
|
|
302
314
|
return new Expr(
|
|
303
|
-
|
|
304
|
-
"Concat" /* Concat */,
|
|
305
|
-
this[Expr.Data],
|
|
306
|
-
ExprData.create(that)
|
|
315
|
+
ExprData.createAll(this, that, ...rest).reduce(
|
|
316
|
+
(a, b) => new ExprData.BinOp("Concat" /* Concat */, a, b)
|
|
307
317
|
)
|
|
308
318
|
);
|
|
309
319
|
}
|
package/dist/define/Ops.js
CHANGED
|
@@ -26,10 +26,10 @@ const isGreater = (a, b) => Expr.create(a).isGreater(b);
|
|
|
26
26
|
const isGreaterOrEqual = (a, b) => Expr.create(a).isGreaterOrEqual(b);
|
|
27
27
|
const isLess = (a, b) => Expr.create(a).isLess(b);
|
|
28
28
|
const isLessOrEqual = (a, b) => Expr.create(a).isLessOrEqual(b);
|
|
29
|
-
const add = (a, b, ...rest) =>
|
|
30
|
-
const subtract = (a, b, ...rest) =>
|
|
31
|
-
const multiply = (a, b, ...rest) =>
|
|
32
|
-
const divide = (a, b, ...rest) =>
|
|
29
|
+
const add = (a, b, ...rest) => Expr.create(a).add(b, ...rest);
|
|
30
|
+
const subtract = (a, b, ...rest) => Expr.create(a).subtract(b, ...rest);
|
|
31
|
+
const multiply = (a, b, ...rest) => Expr.create(a).multiply(b, ...rest);
|
|
32
|
+
const divide = (a, b, ...rest) => Expr.create(a).divide(b, ...rest);
|
|
33
33
|
const remainder = (a, b) => Expr.create(a).remainder(b);
|
|
34
34
|
const concat = (a, b) => Expr.create(a).concat(b);
|
|
35
35
|
const like = (a, b) => Expr.create(a).like(b);
|