subscript 5.5.0 → 5.5.1
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/README.md +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ _Subscript_ is micro-language with common syntax subset of C++, JS, Java, Python
|
|
|
7
7
|
|
|
8
8
|
* Well-known syntax
|
|
9
9
|
* Any _subscript_ fragment can be copy-pasted to any target language
|
|
10
|
-
* It's tiny <sub
|
|
10
|
+
* It's tiny <sub><a href="https://bundlephobia.com/package/subscript@5.5.0"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/subscript/latest?color=brightgreen&label=gzip"/></a></sub>
|
|
11
11
|
* It's :rocket: fast ([see performance](#performance))
|
|
12
12
|
* Configurable & extensible
|
|
13
13
|
* Trivial to use...
|
|
@@ -30,7 +30,7 @@ _Subscript_ is designed to be useful for:
|
|
|
30
30
|
* custom DSL
|
|
31
31
|
|
|
32
32
|
[_Jsep_](https://github.com/EricSmekens/jsep) is generally fine for the listed tasks, unless you need dependencies as small as possible.
|
|
33
|
-
_Subscript_ has [2.
|
|
33
|
+
_Subscript_ has [2.4kb](https://npmfs.com/package/subscript/5.5.0/subscript.min.js) footprint vs [11.4kb](https://npmfs.com/package/jsep/1.2.0/dist/jsep.min.js) _jsep_ + [4.5kb](https://npmfs.com/package/expression-eval/5.0.0/dist/expression-eval.module.js) _expression-eval_, with _jsep_ test coverage and better performance.
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
## Evaluation
|
|
@@ -47,7 +47,7 @@ _Subscript_ parser generates lispy calltree (compatible with [frisk](https://npm
|
|
|
47
47
|
```js
|
|
48
48
|
import {evaluate} from 'subscript.js'
|
|
49
49
|
|
|
50
|
-
evaluate(['+', ['*', 'min', 60], '
|
|
50
|
+
evaluate(['+', ['*', 'min', 60], '@sec'], { min: 5 }) // min*60 + "sec" == "300sec"
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Extending
|
|
@@ -136,7 +136,7 @@ It adds support of:
|
|
|
136
136
|
```js
|
|
137
137
|
import { parse, evaluate } from 'subscript/justin.js'
|
|
138
138
|
|
|
139
|
-
let xy = parse('{ x: 1, "y": 2+2 }["x"]') // ['[', {x:1, y: ['+', 2, 2]}, '
|
|
139
|
+
let xy = parse('{ x: 1, "y": 2+2 }["x"]') // ['[', {x:1, y: ['+', 2, 2]}, '@x']
|
|
140
140
|
evaluate(xy) // 1
|
|
141
141
|
```
|
|
142
142
|
|