Skip to content

Commit 486e284

Browse files
authored
feat: update README and fix github release (#7)
1 parent 6dbcb1a commit 486e284

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# expression-eval
22

3-
[![Latest NPM release](https://img.shields.io/npm/v/expression-eval.svg)](https://www.npmjs.com/package/expression-eval)
4-
[![Minzipped size](https://badgen.net/bundlephobia/minzip/expression-eval)](https://bundlephobia.com/result?p=expression-eval)
5-
[![License](https://img.shields.io/badge/license-MIT-007ec6.svg)](https://github.com/donmccurdy/expression-eval/blob/master/LICENSE)
6-
[![CI](https://github.com/donmccurdy/expression-eval/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/donmccurdy/expression-eval/actions?query=workflow%3ACI)
3+
[![NPM version][npm-image]][npm-url]
4+
[![NPM download][download-image]][download-url]
5+
[![ci](https://github.com/node-casbin/expression-eval/actions/workflows/ci.yml/badge.svg)](https://github.com/node-casbin/expression-eval/actions/workflows/ci.yml)
6+
[![Coverage Status](https://coveralls.io/repos/github/node-casbin/expression-eval/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/expression-eval?branch=master)
7+
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)
8+
9+
[npm-image]: https://img.shields.io/npm/v/@casbin/expression-eval.svg?style=flat-square
10+
[npm-url]: https://npmjs.org/package/@casbin/expression-eval
11+
[download-image]: https://img.shields.io/npm/dm/@casbin/expression-eval.svg?style=flat-square
12+
[download-url]: https://npmjs.org/package/@casbin/expression-eval
713

814
JavaScript expression parsing and evaluation.
915

@@ -14,26 +20,26 @@ Powered by [jsep](https://github.com/soney/jsep).
1420
Install:
1521

1622
```
17-
npm install --save expression-eval
23+
npm install --save @casbin/expression-eval
1824
```
1925

2026
Import:
2127

2228
```js
2329
// ES6
24-
import { parse, eval } from 'expression-eval';
30+
import { parse, eval } from '@casbin/expression-eval';
2531
// CommonJS
26-
const { parse, eval } = require('expression-eval');
32+
const { parse, eval } = require('@casbin/expression-eval');
2733
// UMD / standalone script
28-
const { parse, eval } = window.expressionEval;
34+
const { parse, eval } = window['@casbin/expression-eval'];
2935
```
3036

3137
## API
3238

3339
### Parsing
3440

3541
```javascript
36-
import { parse } from 'expression-eval';
42+
import { parse } from '@casbin/expression-eval';
3743
const ast = parse('1 + foo');
3844
```
3945

@@ -58,7 +64,7 @@ The result of the parse is an AST (abstract syntax tree), like:
5864
### Evaluation
5965

6066
```javascript
61-
import { parse, eval } from 'expression-eval';
67+
import { parse, eval } from '@casbin/expression-eval';
6268
const ast = parse('a + b / c'); // abstract syntax tree (AST)
6369
const value = eval(ast, {a: 2, b: 2, c: 5}); // 2.4
6470
```
@@ -68,7 +74,7 @@ Alternatively, use `evalAsync` for asynchronous evaluation.
6874
### Compilation
6975

7076
```javascript
71-
import { compile } from 'expression-eval';
77+
import { compile } from '@casbin/expression-eval';
7278
const fn = compile('foo.bar + 10');
7379
fn({foo: {bar: 'baz'}}); // 'baz10'
7480
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"dev": "microbundle watch",
1616
"build": "microbundle",
1717
"test": "jest",
18-
"preversion": "npm run build && npm test",
19-
"postversion": "git push && git push --tags && npm publish",
18+
"prepublish": "yarn lint && yarn build",
19+
"release": "standard-version",
2020
"typecheck": "tsc --noEmit",
2121
"lint": "eslint . --ext .ts",
2222
"coverage": "jest --coverage"

0 commit comments

Comments
 (0)