Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Feb 17, 2024
2 parents 74dcda3 + ef382e2 commit aed8d51
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img alt="subscript" src="/subscript2.svg" height=28/> <!--sub͘<em>script</em>--> <!--<sub>SUB͘<em>SCRIPT</em></sub>--> <a href="https://github.com/spectjs/subscript/actions/workflows/node.js.yml"><img src="https://github.com/spectjs/subscript/actions/workflows/node.js.yml/badge.svg"/></a> <a href="https://bundlephobia.com/package/subscript"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/subscript/latest?color=brightgreen&label=gzip"/></a> <a href="http://npmjs.org/subscript"><img src="https://img.shields.io/npm/v/subscript"/></a> <a href="http://microjs.com/#subscript"><img src="https://img.shields.io/badge/microjs-subscript-blue?color=darkslateblue"/></a>
# sub<em>script</em> <a href="https://github.com/spectjs/subscript/actions/workflows/node.js.yml"><img src="https://github.com/spectjs/subscript/actions/workflows/node.js.yml/badge.svg"/></a> <a href="https://bundlephobia.com/package/subscript"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/subscript/latest?color=brightgreen&label=gzip"/></a> <a href="http://npmjs.org/subscript"><img src="https://img.shields.io/npm/v/subscript"/></a> <a href="http://microjs.com/#subscript"><img src="https://img.shields.io/badge/microjs-subscript-blue?color=darkslateblue"/></a>

> _Subscript_ is fast, tiny & extensible expression evaluator / microlanguage.
Expand Down Expand Up @@ -102,7 +102,7 @@ fn({min: 5}) // min*60 + "sec" == "300sec"

## Extending

_Subscript_ provides API to customize or extend syntax:
_Subscript_ provides pluggable language [features](./features) and API to customize syntax:

* `unary(str, precedence, postfix=false)` − register unary operator, either prefix or postfix.
* `binary(str, precedence, rightAssoc=false)` − register binary operator, optionally right-associative.
Expand All @@ -114,6 +114,10 @@ _Subscript_ provides API to customize or extend syntax:
```js
import script, { compile, operator, unary, binary, token } from './subscript.js'

// include objects/arrays syntax
import 'subscript/feature/array.js';
import 'subscript/feature/object.js';

// add identity operators with precedence 9
binary('===', 9), binary('!==', 9)
operator('===', (a, b) => (a = compile(a), b = compile(b), ctx => a(ctx)===b(ctx)))
Expand Down
16 changes: 0 additions & 16 deletions subscript.svg

This file was deleted.

4 changes: 0 additions & 4 deletions subscript2.svg

This file was deleted.

Loading

0 comments on commit aed8d51

Please sign in to comment.