# @buxlabs/ejs-lexer

> ejs lexer

Latest version **1.1.0** (published 2018-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @buxlabs/ejs-lexer
pnpm add @buxlabs/ejs-lexer
yarn add @buxlabs/ejs-lexer
bun add @buxlabs/ejs-lexer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-11-07 |
| First published | 2018-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Emil Ajdyna |
| Maintainers | buxlabs-dev, emilos, pkonieczniak |
| Keywords | ejs, lexer |

## Links

- npm: https://www.npmjs.com/package/@buxlabs/ejs-lexer
- Repository: https://github.com/buxlabs/ejs-lexer
- Homepage: https://github.com/buxlabs/ejs-lexer#readme
- Issues: https://github.com/buxlabs/ejs-lexer/issues
- npm.io page: https://npm.io/package/@buxlabs/ejs-lexer

## Recent versions

- 1.1.0 (latest) — 2018-11-07
- 1.0.0 — 2018-02-15

## README

# ejs-lexer

![npm (scoped)](https://img.shields.io/npm/v/@buxlabs/ejs-lexer.svg)

> ejs lexer

## Installation

```
npm install @buxlabs/ejs-lexer
```

## Usage

```js
const lexer = require('@buxlabs/ejs-lexer')
const tokens = lexer('<div><%- foo %></div>')
console.log(tokens)
```

## How does it work?

It translates a string into an array of tokens with type and value

```html
<div><% foo %><%- bar %><%= baz %><%_ biz %><%# boss %></div>
```

```js
[
  { type: 'string', value: '<div>' },
  { type: 'evaluate', value: 'foo' },
  { type: 'escape', value: 'bar' },
  { type: 'interpolate', value: 'baz' },
  { type: 'slurp', value: 'biz' },
  { type: 'comment', value: 'boss' },
  { type: 'string', value: '</div>'}
]
```

There are six types: `string`, `evaluate`, `escape`, `interpolate`, `slurp` and `comment`. The value of the ejs specific types is trimmed.


## License

MIT

---
_Source: https://npm.io/package/@buxlabs/ejs-lexer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
