jexp 0.0.12 → 0.1.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.
Files changed (4) hide show
  1. package/README.md +249 -47
  2. package/index.js +39 -39
  3. package/index.js.map +1 -1
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -4,10 +4,12 @@ Command line application that allows parser and evaluator of json/yaml applying
4
4
 
5
5
  ## Features
6
6
 
7
- - Functions and arrow functions
8
7
  - Constants, enums, variables, objects and arrays
9
8
  - Arithmetic, assignment, comparison, Logical and bitwise operators
9
+ - Functions and arrow functions
10
+ - distinct and group by
10
11
  - Environment variables
12
+ - json and yaml
11
13
 
12
14
  ## Global installation
13
15
 
@@ -85,28 +87,26 @@ file orders.js
85
87
 
86
88
  ```json
87
89
  [
88
- {
89
- "number": "20001",
90
- "customer": {"firstName":"John", "lastName":"Murphy"},
91
- "orderTime": "2022-07-30T10:15:54",
92
- "total": 12.19,
93
- "details": [
94
- {"article":"Potato", "unitPrice":1.54,"qty":5},
95
- {"article":"Onion", "unitPrice":1.23, "qty":2},
96
- {"article":"White grape", "unitPrice":2.03, "qty":1}
97
- ]
98
- },
99
- {
100
- "number": "20002",
101
- "customer": {"firstName":"Paul", "lastName":"Smith"},
102
- "orderTime": "2022-07-30T12:12:43",
103
- "total": 7.91,
104
- "details": [
105
- {"article":"Apple", "unitPrice":2.15, "qty":1},
106
- {"article":"Banana", "unitPrice":1.99, "qty":2},
107
- {"article":"Pear", "unitPrice":1.78, "qty":1}
108
- ]
109
- }
90
+ {
91
+ "number": "20001",
92
+ "customer": { "firstName": "John", "lastName": "Murphy" },
93
+ "orderTime": "2022-07-30T10:15:54",
94
+ "details": [
95
+ { "article": "Pear", "unitPrice": 1.78, "qty": 2 },
96
+ { "article": "Banana", "unitPrice": 1.99, "qty": 1 },
97
+ { "article": "White grape", "unitPrice": 2.03, "qty": 1 }
98
+ ]
99
+ },
100
+ {
101
+ "number": "20002",
102
+ "customer": { "firstName": "Paul", "lastName": "Smith" },
103
+ "orderTime": "2022-07-30T12:12:43",
104
+ "details": [
105
+ { "article": "Apple", "unitPrice": 2.15, "qty": 1 },
106
+ { "article": "Banana", "unitPrice": 1.99, "qty": 2 },
107
+ { "article": "Pear", "unitPrice": 1.78, "qty": 1 }
108
+ ]
109
+ }
110
110
  ]
111
111
  ```
112
112
 
@@ -119,7 +119,7 @@ jexp '.' ./data/orders.json
119
119
  Result:
120
120
 
121
121
  ```json
122
- [{"number":"20001","customer":{"firstName":"John","lastName":"Murphy"},"orderTime":"2022-07-30T10:15:54","total":12.19,"details":[{"article":"Potato","unitPrice":1.54,"qty":5},{"article":"Onion","unitPrice":1.23,"qty":2},{"article":"White grape","unitPrice":2.03,"qty":1}]},{"number":"20002","customer":{"firstName":"Paul","lastName":"Smith"},"orderTime":"2022-07-30T12:12:43","total":7.91,"details":[{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]}]
122
+ [{"number":"20001","customer":{"firstName":"John","lastName":"Murphy"},"orderTime":"2022-07-30T10:15:54","details":[{"article":"Pear","unitPrice":1.78,"qty":2},{"article":"Banana","unitPrice":1.99,"qty":1},{"article":"White grape","unitPrice":2.03,"qty":1}]},{"number":"20002","customer":{"firstName":"Paul","lastName":"Smith"},"orderTime":"2022-07-30T12:12:43","details":[{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]}]
123
123
  ```
124
124
 
125
125
  Returns the number property of the list
@@ -154,23 +154,23 @@ jexp '.[0]' ./data/orders.json -o yaml
154
154
 
155
155
  Result:
156
156
 
157
- ```yaml
157
+ ```json
158
158
  number: '20001'
159
159
  customer:
160
160
  firstName: John
161
161
  lastName: Murphy
162
162
  orderTime: '2022-07-30T10:15:54'
163
- total: 12.19
164
163
  details:
165
- - article: Potato
166
- unitPrice: 1.54
167
- qty: 5
168
- - article: Onion
169
- unitPrice: 1.23
164
+ - article: Pear
165
+ unitPrice: 1.78
170
166
  qty: 2
167
+ - article: Banana
168
+ unitPrice: 1.99
169
+ qty: 1
171
170
  - article: White grape
172
171
  unitPrice: 2.03
173
172
  qty: 1
173
+
174
174
  ```
175
175
 
176
176
  Returns the details property of the first element in beautiful format
@@ -184,14 +184,14 @@ Result:
184
184
  ```json
185
185
  [
186
186
  {
187
- "article": "Potato",
188
- "unitPrice": 1.54,
189
- "qty": 5
187
+ "article": "Pear",
188
+ "unitPrice": 1.78,
189
+ "qty": 2
190
190
  },
191
191
  {
192
- "article": "Onion",
193
- "unitPrice": 1.23,
194
- "qty": 2
192
+ "article": "Banana",
193
+ "unitPrice": 1.99,
194
+ "qty": 1
195
195
  },
196
196
  {
197
197
  "article": "White grape",
@@ -210,7 +210,7 @@ jexp '.details' ./data/orders.json
210
210
  Result:
211
211
 
212
212
  ```json
213
- [{"article":"Potato","unitPrice":1.54,"qty":5},{"article":"Onion","unitPrice":1.23,"qty":2},{"article":"White grape","unitPrice":2.03,"qty":1},{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]
213
+ [{"article":"Pear","unitPrice":1.78,"qty":2},{"article":"Banana","unitPrice":1.99,"qty":1},{"article":"White grape","unitPrice":2.03,"qty":1},{"article":"Apple","unitPrice":2.15,"qty":1},{"article":"Banana","unitPrice":1.99,"qty":2},{"article":"Pear","unitPrice":1.78,"qty":1}]
214
214
  ```
215
215
 
216
216
  Returns the article property of the list of details of each element of the list
@@ -222,7 +222,7 @@ jexp '.details.article' ./data/orders.json
222
222
  Result:
223
223
 
224
224
  ```json
225
- ["Potato","Onion","White grape","Apple","Banana","Pear"]
225
+ ["Pear","Banana","White grape","Apple","Banana","Pear"]
226
226
  ```
227
227
 
228
228
  Get the minimum of the total property
@@ -234,7 +234,7 @@ jexp '.min(p=> p.total)' ./data/orders.json
234
234
  Result:
235
235
 
236
236
  ```json
237
- 7.91
237
+ null
238
238
  ```
239
239
 
240
240
  Get the minimum of the article property from all the details
@@ -258,7 +258,7 @@ jexp '.details.max(p=> p.unitPrice * p.qty )' ./data/orders.json
258
258
  Result:
259
259
 
260
260
  ```json
261
- 7.7
261
+ 3.98
262
262
  ```
263
263
 
264
264
  Get the middle value "unitPrice * p.qty" from all the details
@@ -270,7 +270,7 @@ jexp '.details.avg(p=> p.unitPrice * p.qty )' ./data/orders.json
270
270
  Result:
271
271
 
272
272
  ```json
273
- 3.35
273
+ 2.5816666666666666
274
274
  ```
275
275
 
276
276
  Gets the sum of the total property
@@ -282,7 +282,7 @@ jexp '.sum(p=> p.total )' ./data/orders.json
282
282
  Result:
283
283
 
284
284
  ```json
285
- 20.1
285
+ 0
286
286
  ```
287
287
 
288
288
  Get the sum "unitPrice * p.qty" of the details of item 1 of the list
@@ -318,7 +318,7 @@ jexp '.details.first(p=> p.unitPrice * p.qty < 3 ).article' ./data/orders.json
318
318
  Result:
319
319
 
320
320
  ```json
321
- "Onion"
321
+ "Banana"
322
322
  ```
323
323
 
324
324
  Get the last article property of all details where "unitPrice * p.qty" is less than 3
@@ -343,9 +343,9 @@ Result:
343
343
 
344
344
  ```json
345
345
  {
346
- "article": "Onion",
347
- "unitPrice": 1.23,
348
- "qty": 2
346
+ "article": "Banana",
347
+ "unitPrice": 1.99,
348
+ "qty": 1
349
349
  }
350
350
  ```
351
351
 
@@ -361,6 +361,208 @@ Result:
361
361
  20.1
362
362
  ```
363
363
 
364
+ Get the smallest article
365
+
366
+ ```sh
367
+ jexp '.details.min(p=> p.article )' ./data/orders.json
368
+ ```
369
+
370
+ Result:
371
+
372
+ ```json
373
+ "Apple"
374
+ ```
375
+
376
+ Get the total of all the details
377
+
378
+ ```sh
379
+ jexp '.details.max(p=> p.unitPrice * p.qty )' ./data/orders.json
380
+ ```
381
+
382
+ Result:
383
+
384
+ ```json
385
+ 3.98
386
+ ```
387
+
388
+ Get the mean value of all details
389
+
390
+ ```sh
391
+ jexp '.details.avg(p=> p.unitPrice * p.qty )' ./data/orders.json
392
+ ```
393
+
394
+ Result:
395
+
396
+ ```json
397
+ 2.5816666666666666
398
+ ```
399
+
400
+ Get the total of the details of order 1
401
+
402
+ ```sh
403
+ jexp '[1].details.sum(p=> p.unitPrice * p.qty )' ./data/orders.json
404
+ ```
405
+
406
+ Result:
407
+
408
+ ```json
409
+ 0
410
+ ```
411
+
412
+ Gets the number of details where the subtotal is less than 3
413
+
414
+ ```sh
415
+ jexp '.details.count(p=> p.unitPrice * p.qty < 3 )' ./data/orders.json
416
+ ```
417
+
418
+ Result:
419
+
420
+ ```json
421
+ 4
422
+ ```
423
+
424
+ Get the article of the first detail where the subtotal is less than 3
425
+
426
+ ```sh
427
+ jexp '.details.first(p=> p.unitPrice * p.qty < 3 ).article' ./data/orders.json
428
+ ```
429
+
430
+ Result:
431
+
432
+ ```json
433
+ "Banana"
434
+ ```
435
+
436
+ Get the article of the last detail where the subtotal is less than 3
437
+
438
+ ```sh
439
+ jexp '.details.last(p=> p.unitPrice * p.qty < 3 ).article
440
+ ```
441
+
442
+ Result:
443
+
444
+ ```json
445
+ /bin/sh: 1: Syntax error: Unterminated quoted string
446
+ ```
447
+
448
+ Get the first detail where the subtotal is less than 3
449
+
450
+ ```sh
451
+ jexp '.details.first(p=> p.unitPrice * p.qty < 3 )' ./data/orders.json
452
+ ```
453
+
454
+ Result:
455
+
456
+ ```json
457
+ {"article":"Banana","unitPrice":1.99,"qty":1}
458
+ ```
459
+
460
+ Calculate the total for each order
461
+
462
+ ```sh
463
+ jexp '.each(p=>p.total=p.details.sum(q=>q.qty*q.unitPrice)).map(p=>{nro:p.number,total:p.total})' ./data/orders.json
464
+ ```
465
+
466
+ Result:
467
+
468
+ ```json
469
+ [{"nro":"20001","total":7.58},{"nro":"20002","total":7.91}]
470
+ ```
471
+
472
+ Calculate the subtotal for each order
473
+
474
+ ```sh
475
+ jexp '.details.foreach(p=>p.subtotal=p.qty*p.unitPrice).subtotal' ./data/orders.json
476
+ ```
477
+
478
+ Result:
479
+
480
+ ```json
481
+ [3.56,1.99,2.03,2.15,3.98,1.78]
482
+ ```
483
+
484
+ calculates the total of all the details
485
+
486
+ ```sh
487
+ jexp '.details.foreach(p=>total=nvl(total,0)+p.qty*p.unitPrice);total' ./data/orders.json
488
+ ```
489
+
490
+ Result:
491
+
492
+ ```json
493
+ 15.49
494
+ ```
495
+
496
+ Get the list of items without repeating
497
+
498
+ ```sh
499
+ jexp '.details.distinct(p=>p.article)' ./data/orders.json
500
+ ```
501
+
502
+ Result:
503
+
504
+ ```json
505
+ ["Pear","Banana","White grape","Apple"]
506
+ ```
507
+
508
+ Get the list of items and quantity without repeating
509
+
510
+ ```sh
511
+ jexp '.details.distinct(p=>{article:p.article,qty:p.qty})' ./data/orders.json
512
+ ```
513
+
514
+ Result:
515
+
516
+ ```json
517
+ [{"article":"Pear","qty":2},{"article":"Banana","qty":1},{"article":"White grape","qty":1},{"article":"Apple","qty":1},{"article":"Banana","qty":2},{"article":"Pear","qty":1}]
518
+ ```
519
+
520
+ ```sh
521
+ jexp '.details.map(p=>{article:p.article,count:count(1),total:sum(p.qty * p.unitPrice)})' ./data/orders.json
522
+ ```
523
+
524
+ Result:
525
+
526
+ ```json
527
+ [{"article":"Pear","count":2,"total":5.34},{"article":"Banana","count":2,"total":5.97},{"article":"White grape","count":1,"total":2.03},{"article":"Apple","count":1,"total":2.15}]
528
+ ```
529
+
530
+ Get the total of the first order
531
+
532
+ ```sh
533
+ jexp '{total:.[0].details.sum(p=>p.qty * p.unitPrice)}' ./data/orders.json
534
+ ```
535
+
536
+ Result:
537
+
538
+ ```json
539
+ {"total":7.58}
540
+ ```
541
+
542
+ Get the total of the last order
543
+
544
+ ```sh
545
+ jexp '{total:.[.length()-1].details.sum(p=>p.qty * p.unitPrice)}' ./data/orders.json
546
+ ```
547
+
548
+ Result:
549
+
550
+ ```json
551
+ {"total":7.91}
552
+ ```
553
+
554
+ List the orders with their totals
555
+
556
+ ```sh
557
+ jexp '.map(p=>{nro:p.number,total:p.details.sum(q=>q.qty * q.unitPrice)})' ./data/orders.json
558
+ ```
559
+
560
+ Result:
561
+
562
+ ```json
563
+ [{"nro":"20001","total":7.58},{"nro":"20002","total":7.91}]
564
+ ```
565
+
364
566
  ## js-expression
365
567
 
366
568
  [Js-expression](https://www.npmjs.com/package/js-expressions) is an extensible expression evaluator and parser. \
package/index.js CHANGED
@@ -19,49 +19,44 @@ const { program, Option } = require('commander');
19
19
  const colorize = require('json-colorizer');
20
20
  const yaml = require('js-yaml');
21
21
  const run = (expression, source, options) => __awaiter(void 0, void 0, void 0, function* () {
22
- try {
23
- let data = {};
24
- let extension = '';
25
- if ((source.startsWith('[') || source.startsWith('{'))) {
26
- data = js_expressions_1.Helper.tryParse(source);
27
- }
28
- else {
29
- extension = path_1.default.extname(source);
30
- if (!['.json', '.yaml', 'yml'].includes(extension)) {
31
- throw Error(`extension ${extension} not supported `);
32
- }
33
- const content = yield js_expressions_1.Helper.readFile(source);
34
- if (!content) {
35
- throw Error(`can not read file ${source}`);
36
- }
37
- if (extension === 'json') {
38
- data = js_expressions_1.Helper.tryParse(content);
39
- }
40
- else {
41
- data = yaml.load(content);
42
- }
22
+ let data = {};
23
+ let extension = '';
24
+ if ((source.startsWith('[') || source.startsWith('{'))) {
25
+ data = js_expressions_1.Helper.tryParse(source);
26
+ }
27
+ else {
28
+ extension = path_1.default.extname(source);
29
+ if (!['.json', '.yaml', 'yml'].includes(extension)) {
30
+ throw Error(`extension ${extension} not supported `);
43
31
  }
44
- if (data === null || data === undefined) {
45
- throw Error(`can not parse content of ${source}`);
32
+ const content = yield js_expressions_1.Helper.readFile(source);
33
+ if (!content) {
34
+ throw Error(`can not read file ${source}`);
46
35
  }
47
- const result = js_expressions_1.expressions.eval(expression, { '.': data });
48
- const forceJson = options.output === 'json';
49
- const forceYaml = options.output === 'yaml';
50
- if (forceYaml || (!forceJson && extension && ['.yaml', 'yml'].includes(extension))) {
51
- console.log(yaml.dump(result));
36
+ if (extension === 'json') {
37
+ data = js_expressions_1.Helper.tryParse(content);
52
38
  }
53
39
  else {
54
- const formatted = options.beautiful ? JSON.stringify(result, null, 2) : JSON.stringify(result);
55
- if (options.decorate) {
56
- console.log(colorize(formatted));
57
- }
58
- else {
59
- console.log(formatted);
60
- }
40
+ data = yaml.load(content);
61
41
  }
62
42
  }
63
- catch (error) {
64
- console.error(error.stack);
43
+ if (data === null || data === undefined) {
44
+ throw Error(`can not parse content of ${source}`);
45
+ }
46
+ const result = js_expressions_1.expressions.eval(expression, { '.': data });
47
+ const forceJson = options.output === 'json';
48
+ const forceYaml = options.output === 'yaml';
49
+ if (forceYaml || (!forceJson && extension && ['.yaml', 'yml'].includes(extension))) {
50
+ console.log(yaml.dump(result));
51
+ }
52
+ else {
53
+ const formatted = options.beautiful ? JSON.stringify(result, null, 2) : JSON.stringify(result);
54
+ if (options.decorate) {
55
+ console.log(colorize(formatted));
56
+ }
57
+ else {
58
+ console.log(formatted);
59
+ }
65
60
  }
66
61
  });
67
62
  const getInput = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -89,8 +84,13 @@ function main() {
89
84
  .option('-d, --decorate', 'Decorate output', false)
90
85
  .option('-q, --query-file <path>', 'query file')
91
86
  .action((expression, source, options) => __awaiter(this, void 0, void 0, function* () {
92
- const data = (source !== undefined) ? source : yield getInput();
93
- yield run(expression, data, options);
87
+ try {
88
+ const data = (source !== undefined) ? source : yield getInput();
89
+ yield run(expression, data, options);
90
+ }
91
+ catch (error) {
92
+ console.error(error.message);
93
+ }
94
94
  }));
95
95
  yield program.parseAsync(process.argv);
96
96
  });
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mDAA2D;AAC3D,gDAAuB;AACvB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,C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AAC,cAAc,CAAC;aACxB,QAAQ,CAAC,UAAU,CAAC;aACpB,SAAS,CAAC,IAAI,MAAM,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;aACxF,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,CAAC;aACpD,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,KAAK,CAAC;aAClD,MAAM,CAAC,yBAAyB,EAAE,YAAY,CAAC;aAC/C,MAAM,CAAC,CAAO,UAAiB,EAAE,MAAU,EAAE,OAAW,EAAE,EAAE;YAC5D,IAAI;gBACH,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,QAAQ,EAAS,CAAA;gBACtE,MAAM,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;aACpC;YAAC,OAAO,KAAS,EAAE;gBACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aAC5B;QACF,CAAC,CAAA,CAAC,CAAA;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;CAAA;AACD,IAAI,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jexp",
3
- "version": "0.0.12",
3
+ "version": "0.1.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,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "commander": "^9.4.0",
21
- "js-expressions": "1.0.10",
21
+ "js-expressions": "1.0.11",
22
22
  "js-yaml": "^4.1.0",
23
23
  "json-colorizer": "^2.2.2"
24
24
  },