# onigasm

> WebAssembly port of Oniguruma regex library

Latest version **2.2.5** (published 2020-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install onigasm
pnpm add onigasm
yarn add onigasm
bun add onigasm
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.5 |
| Published | 2020-09-22 |
| First published | 2018-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 552.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 180 |
| Author | Neek Sandhu |
| Maintainers | aeschli, sweetslush |
| Keywords | oniguruma, onig, regex, wasm, asm, web, assembly |

## Links

- npm: https://www.npmjs.com/package/onigasm
- Repository: https://github.com/NeekSandhu/onigasm
- Homepage: https://github.com/NeekSandhu/onigasm#readme
- Issues: https://github.com/NeekSandhu/onigasm/issues
- npm.io page: https://npm.io/package/onigasm

## Dependencies (1)

- [lru-cache](https://npm.io/package/lru-cache.md) ^5.1.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.2.5 (latest) — 2020-09-22
- 2.2.4 — 2019-11-13
- 2.2.3 — 2019-11-12
- 2.2.2 — 2019-04-19
- 2.2.1 — 2018-06-27
- 2.2.0 — 2018-06-27
- 2.1.0 — 2018-06-17
- 2.0.0 — 2018-05-21
- 1.3.1 — 2018-05-11
- 1.3.0 — 2018-02-22
- 1.2.0 — 2018-02-21
- 1.1.0 — 2018-02-21
- 1.0.1 — 2018-02-20
- 1.0.0 — 2018-02-20

## README

# Onigasm (**Onig**uruma**ASM**)

`WebAssembly` port of Oniguruma regex library.

Usage/API/Behaviour 1:1 with [`node-oniguruma`](https://github.com/atom/node-oniguruma) port, tests are literally imported from `node-oniguruma` repository for maximum compliance.

Of course, unlike `node-oniguruma`, this library can't hook into roots of `V8` and is therefore 2 times* slower than the former.

## Instructions for porting your app to web

### Install

```bash
npm i onigasm
```

### Light it up

> WASM must be loaded before you use any other feature like `OnigRegExp` or `OnigScanner`

```javascript
// index.js (entry point)

import { loadWASM } from 'onigasm'
import App from './App'

(async () => {
    await loadWASM('path/to/onigasm.wasm') // You can also pass ArrayBuffer of onigasm.wasm file
    App.start()
})()

// `onigasm.wasm` file will be available at `onigasm/lib/onigasm.wasm` in `node_modules` of your project directory
```

> Once loaded `onigasm` is a drop-in replacement for `oniguruma`

```diff
- import { OnigRegExp } from 'oniguruma'
+ import { OnigRegExp } from 'onigasm'
```

### That's it!

\* Tested under laboratory conditions using `benchmark.js`
___

### License

`onigasm` is licensed under MIT License. See `LICENSE` in the root of this project for more info.

### Contributors/Maintainers
- [@neeksandhu](https://github.com/NeekSandhu) (Neek Sandhu)
- [@aeschli](https://github.com/aeschli) (Martin Aeschlimann)

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