Skip to content

Commit 66c5e8a

Browse files
author
Marek Sierociński
committed
Version 0.7.0
1 parent 3ae92cd commit 66c5e8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4358
-1818
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ trim_trailing_whitespace = true
2121
indent_size = 2
2222

2323
[*.md]
24-
indent_size = 4
24+
indent_size = 2
2525
trim_trailing_whitespace = false

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"browser": true,
44
"commonjs": true,
55
"shared-node-browser": true,
6-
"amd": true,
76
"mocha": true,
87
"es6": true
98
},
9+
"globals": {
10+
"globalThis": true
11+
},
1012
"extends": "eslint:recommended",
1113
"parserOptions": {
1214
"ecmaVersion": 6,

.npmignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ jsdoc.json
99
test/
1010
coverage/
1111

12-
# Source files
13-
src/
14-
1512
# Configs
1613
.babelrc
1714
rollup.config.js

README.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,60 @@
66

77
## Info
88

9-
This is *not* a "safe JavaScript eval". This is small library that only mimics `eval()` functionality to some point.
10-
It always returns the value of given expression. You always need to provide context in which it will be executed
11-
(context *must be* an Object).
9+
This is **not** a "safe JavaScript eval". This library only mimics `eval()` functionality to some point.
10+
It always returns the value of given expression. You always need to provide context in which it will be executed (context **must be** an Object).
11+
12+
Pure JavaScript! No dependencies! ^^,
1213

1314
### What's working
1415

15-
* simple one-line expressions
16-
* single argument operator: `!`, `typeof`
17-
* all two argument operators: `*`, `/`, `%`, `+`, `-`, `>=`, `<=`, `>`, `<`, `===`, `!==`, `==`, `!=`, `&&` and `||`
18-
* three argument operator: `?:`
16+
* one-argument operators:
17+
* `! ...`
18+
* `~ ...`
19+
* `+ ...`
20+
* `- ...`
21+
* `typeof ...`
22+
* two-argument operators:
23+
* `... . ...` (member accessor)
24+
* `... * ...`
25+
* `... / ...`
26+
* `... % ...`
27+
* `... + ...`
28+
* `... - ...`
29+
* `... >= ...`
30+
* `... <= ...`
31+
* `... > ...`
32+
* `... < ...`
33+
* `... instanceof ...`
34+
* `... in ...`
35+
* `... === ...`
36+
* `... !== ...`
37+
* `... == ...`
38+
* `... != ...`
39+
* `... && ...`
40+
* `... || ...`
41+
* `... & ...`
42+
* `... | ...`
43+
* `... ^ ...`
44+
* three-argument operator:
45+
* `... ? ... : ...`
1946
* Strings, Numbers (both Integers and Floats) and Booleans
20-
* global properties: `undefined`, `null`, `NaN` and `Infinity`
21-
* using `.` accessor
47+
* Node: Interpolation in Strings is not planned for now to be implemented
48+
* properties:
49+
* `undefined`
50+
* `null`
51+
* `NaN`
52+
* `Infinity`
53+
* grouping (paranthesis)
2254
* calling methods
23-
* accessing allowed global Objects such as `Date`, `Math`, `Number`, `String`, `Array` and `Object`
24-
* paranthesis
25-
* simple mixing above
55+
* support nested methods (e.g. `foo(1, bar(item.a, item.b))`)
56+
* mixing above
2657

2758
### TODO
2859

29-
* support single argument operators: `new`, `-`, `+`
30-
* support `[]` accessor
31-
* support nested methods (e.g. `Math.min(1, Math.max(item.a, item.b))`)
32-
* maybe validating proper JS syntax?
60+
* one-argument operators:
61+
* `new` (I don't know if it's good idea?)
62+
* accessing allowed global Objects such as `Date`, `Math`, `Number`, `String`, `Array` and `Object`
3363

3464
## Usage
3565

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"url": "git@github.com:marverix/meval.git"
1212
},
1313
"ignore": [
14-
"src", "test"
14+
"src", "test", "docs"
1515
]
1616
}

0 commit comments

Comments
 (0)