### Install @jsep-plugin/async-await
Source: https://github.com/ericsmekens/jsep/blob/master/packages/async-await/README.md
Install the plugin using npm or yarn.
```console
npm install @jsep-plugin/async-await
# or
yarn add @jsep-plugin/async-await
```
--------------------------------
### Install @jsep-plugin/spread
Source: https://github.com/ericsmekens/jsep/blob/master/packages/spread/README.md
Install the plugin with npm or yarn.
```console
npm install @jsep-plugin/spread
# or
yarn add @jsep-plugin/spread
```
--------------------------------
### Install with npm or yarn
Source: https://github.com/ericsmekens/jsep/blob/master/packages/assignment/README.md
Install the plugin using npm or yarn.
```console
npm install @jsep-plugin/assignment
# or
yarn add @jsep-plugin/assignment
```
--------------------------------
### Install dependencies with pnpm
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Run this command in the project root to install dependencies.
```bash
pnpm install
```
--------------------------------
### Prepare project with pnpm
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Run this command after installing dependencies to prepare the project for development.
```bash
pnpm run prepare
```
--------------------------------
### Install @jsep-plugin/regex
Source: https://github.com/ericsmekens/jsep/blob/master/packages/regex/README.md
Install the plugin via npm or yarn.
```console
npm install @jsep-plugin/regex
# or
yarn add @jsep-plugin/regex
```
--------------------------------
### Install @jsep-plugin/template
Source: https://github.com/ericsmekens/jsep/blob/master/packages/template/README.md
Install the plugin via npm or yarn.
```console
npm install @jsep-plugin/template
# or
yarn add @jsep-plugin/template
```
--------------------------------
### Usage example
Source: https://github.com/ericsmekens/jsep/blob/master/packages/numbers/README.md
Registers the plugin with JSEP.
```javascript
import jsep from 'jsep';
import jsepNumbers from '@jsep-plugin/numbers';
jsep.plugins.register(jsepNumbers);
```
--------------------------------
### Install @jsep-plugin/new with npm or yarn
Source: https://github.com/ericsmekens/jsep/blob/master/packages/new/README.md
Install the plugin using npm or yarn.
```console
npm install @jsep-plugin/new
# or
yarn add @jsep-plugin/new
```
--------------------------------
### Install @jsep-plugin/object
Source: https://github.com/ericsmekens/jsep/blob/master/packages/object/README.md
Install the plugin via npm or yarn.
```console
npm install @jsep-plugin/object
# or
yarn add @jsep-plugin/object
```
--------------------------------
### Install @jsep-plugin/ternary via npm or yarn
Source: https://github.com/ericsmekens/jsep/blob/master/packages/ternary/README.md
Install the plugin using npm or yarn. The commands are shown in a console block.
```console
npm install @jsep-plugin/ternary
# or
yarn add @jsep-plugin/ternary
```
--------------------------------
### Example of number formats
Source: https://github.com/ericsmekens/jsep/blob/master/packages/numbers/README.md
Shows how the plugin parses hexadecimal, binary, octal, and decimal numbers with underscores.
```javascript
jsep('0xA'); // hexadecimal (10)
jsep('0b01001010'); // binary (74)
jsep('0644'); // octal (420)
jsep('0o644'); // octal (420)
jsep('115_200'); // decimal (115200)
```
--------------------------------
### Build jsep with npm install and npm run default
Source: https://github.com/ericsmekens/jsep/blob/master/README.md
Run these commands in the jsep project directory to create the built files in the build/ directory.
```bash
npm install
npm run default
```
--------------------------------
### Comment expression examples
Source: https://github.com/ericsmekens/jsep/blob/master/packages/comment/README.md
Shows three example expressions that the plugin can parse, including end-of-line and block comments.
```javascript
jsep('a = 2 // end of line comment');
jsep('a /* ignore this */ += 2');
jsep('a /* ignore \n this */ ++');
```
--------------------------------
### Spread expression examples
Source: https://github.com/ericsmekens/jsep/blob/master/packages/spread/README.md
Shows the three expression forms the plugin enables: spread in a function call, object spread, and array spread.
```javascript
jsep('fn(1, ...a)');
jsep('{ ...a }');
jsep('[...a]');
```
--------------------------------
### Regex expression examples
Source: https://github.com/ericsmekens/jsep/blob/master/packages/regex/README.md
Shows the supported regex expression forms that the plugin enables, including literal patterns, flags, and a regex method call.
```javascript
jsep('/abc/');
jsep('/abc/ig');
jsep('/[a-z]{3}/ig.test(a)');
```
--------------------------------
### Assignment expression examples
Source: https://github.com/ericsmekens/jsep/blob/master/packages/assignment/README.md
Shows the assignment expressions supported by the plugin: assignment, compound assignment, and increment/decrement operators.
```javascript
jsep('a = 2');
jsep('a += 2');
jsep('a++');
jsep('--aa');
```
--------------------------------
### Template literal expression examples
Source: https://github.com/ericsmekens/jsep/blob/master/packages/template/README.md
Shows the two forms of template literal expressions supported by this plugin: a plain template literal and a tagged template literal with a tag name.
```javascript
jsep('`hi ${name}`');
jsep('msg`hi ${name}`');
```
--------------------------------
### Register @jsep-plugin/async-await
Source: https://github.com/ericsmekens/jsep/blob/master/packages/async-await/README.md
Import and register the plugin with JSEP.
```javascript
import jsep from 'jsep';
import jsepAsyncAwait from '@jsep-plugin/async-await';
jsep.plugins.register(jsepAsyncAwait);
```
--------------------------------
### Using @jsep-plugin/new to parse new expressions
Source: https://github.com/ericsmekens/jsep/blob/master/packages/new/README.md
Shows how to use the plugin to parse expressions like `new Date()` and `new RegExp("^\d+$")`.
```javascript
jsep('new Date()');
jsep('new RegExp("^\d+$")');
```
--------------------------------
### Register @jsep-plugin/new with JSEP
Source: https://github.com/ericsmekens/jsep/blob/master/packages/new/README.md
Import the plugin and register it with JSEP to enable `new` expression support.
```javascript
import jsep from 'jsep';
import jsepNew from '@jsep-plugin/new';
jsep.plugins.register(jsepNew);
```
--------------------------------
### Lint code with npm
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Run this command before committing to ensure code does not violate the project's ESLint code style.
```bash
npm run lint
```
--------------------------------
### Register plugin with JSEP
Source: https://github.com/ericsmekens/jsep/blob/master/packages/arrow/README.md
Import the plugin and register it with JSEP to enable arrow-function support.
```javascript
import jsep from 'jsep';
import jsepArrow from '@jsep-plugin/arrow';
jsep.plugins.register(jsepArrow);
```
--------------------------------
### Register plugin with JSEP
Source: https://github.com/ericsmekens/jsep/blob/master/packages/assignment/README.md
Import the plugin and register it with JSEP to enable assignment expression support.
```javascript
import jsep from 'jsep';
import jsepAssignment from '@jsep-plugin/assignment';
jsep.plugins.register(jsepAssignment);
```
--------------------------------
### Register the ternary plugin with JSEP
Source: https://github.com/ericsmekens/jsep/blob/master/packages/ternary/README.md
Import jsep and the plugin, then register it using jsep.plugins.register(). This enables ternary expression support.
```javascript
import jsep from 'jsep';
import jsepTernary from '@jsep-plugin/ternary';
jsep.plugins.register(jsepTernary);
```
--------------------------------
### Client-side usage with ES module and IIFE builds
Source: https://github.com/ericsmekens/jsep/blob/master/README.md
Shows two ways to load jsep in the browser: an ES module import from jsep.min.js and a classic script tag using jsep.iife.min.js. Both parse the expression '1 + 1'.
```html
...
let parse_tree = jsep("1 + 1");
```
--------------------------------
### Parse ternary expression with jsep('a ? 1 : 2')
Source: https://github.com/ericsmekens/jsep/blob/master/packages/ternary/README.md
Shows how to use the plugin to parse a ternary expression. The expression 'a ? 1 : 2' is passed to jsep().
```javascript
jsep('a ? 1 : 2');
```
--------------------------------
### JSEP async/await expressions
Source: https://github.com/ericsmekens/jsep/blob/master/packages/async-await/README.md
Shows the supported expression forms: 'await a' and 'await a.find(async (v1, v2) => await v1(v2))'.
```javascript
jsep('await a');
jsep('await a.find(async (v1, v2) => await v1(v2))');
```
--------------------------------
### Register @jsep-plugin/object with JSEP
Source: https://github.com/ericsmekens/jsep/blob/master/packages/object/README.md
Register the plugin with JSEP to enable object expression support.
```javascript
import jsep from 'jsep';
import jsepObject from '@jsep-plugin/object';
jsep.plugins.register(jsepObject);
```
--------------------------------
### Register the regex plugin
Source: https://github.com/ericsmekens/jsep/blob/master/packages/regex/README.md
Registers the regex plugin with JSEP so that regex expressions are parsed.
```javascript
import jsep from 'jsep';
import jsepRegex from '@jsep-plugin/regex';
jsep.plugins.register(jsepRegex);
```
--------------------------------
### ESLint rule: semi
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Mandatory semicolons.
```json
"semi": 1
```
--------------------------------
### ESLint rule: no-dupe-args
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Disallows duplicate parameter names in function declarations or expressions.
```json
"no-dupe-args": 1
```
--------------------------------
### Register the spread plugin
Source: https://github.com/ericsmekens/jsep/blob/master/packages/spread/README.md
Registers the spread plugin with JSEP so spread expressions are parsed.
```javascript
import jsep from 'jsep';
import jsepSpread from '@jsep-plugin/spread';
jsep.plugins.register(jsepSpread);
```
--------------------------------
### Register the template literal plugin
Source: https://github.com/ericsmekens/jsep/blob/master/packages/template/README.md
Registers the template literal plugin with JSEP. Import the plugin and call jsep.plugins.register.
```javascript
import jsep from 'jsep';
import jsepTemplateLiteral from '@jsep-plugin/template';
jsep.plugins.register(jsepTemplateLiteral);
```
--------------------------------
### ESLint rule: no-unreachable
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Disallows unreachable code after return, throw, continue, and break statements.
```json
"no-unreachable": 1
```
--------------------------------
### Arrow function expressions
Source: https://github.com/ericsmekens/jsep/blob/master/packages/arrow/README.md
Shows the arrow-function expressions supported by the plugin, such as `v => v === 1`, `(v, i) => i`, and `() => true`.
```javascript
jsep('a.find(v => v === 1)');
jsep('a.map((v, i) => i)');
jsep('a.map(() => true)');
```
--------------------------------
### Parse object expression with @jsep-plugin/object
Source: https://github.com/ericsmekens/jsep/blob/master/packages/object/README.md
Parses an object expression with nested object and member access using the JSEP plugin.
```javascript
jsep('{ a: 1, b: { c }}[d]');
```
--------------------------------
### ESLint rule: no-dupe-keys
Source: https://github.com/ericsmekens/jsep/blob/master/CONTRIBUTING.md
Disallows duplicate keys in object literals.
```json
"no-dupe-keys": 1
```