$ gnpm install onigasm
WebAssembly port of Oniguruma regex library.
Usage/API/Behaviour 1:1 with 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.
npm i onigasm
WASM must be loaded before you use any other feature like
OnigRegExporOnigScanner
// 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
onigasmis a drop-in replacement foroniguruma
- import { OnigRegExp } from 'oniguruma'
+ import { OnigRegExp } from 'onigasm'
* Tested under laboratory conditions using benchmark.js
onigasm is licensed under MIT License. See LICENSE in the root of this project for more info.
Copyright 2013 - present © cnpmjs.org | Home |