0.1.2 • Published 1 year ago

@rhcp/heading_hash_wasm v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

WebAssembly build of the heading_hash transform

This is a WebAssembly build of the heading_hash transform, suitable for use in Nodejs and browsers.

Initial setup

Install wasm-pack.

The wasm-pack site recommends curling into your shell to install, but I prefer using cargo:

cargo install wasm-pack

Once wasm-pack is installed, you can build, test, and publish this package.js

🛠️ Build with

Build for nodejs:

make build_node

Build for web:

make build_web

Default is a release build with optimizations and no debug info. Add --dev for a debug build.

wasm-pack build docs

Using the nodejs package

Add the dependency:

npm i @rhcp/heading_hash_wasm

Import & use it:

import * as headingHash from "@rhcp/heading_hash_wasm";

console.log(headingHash.transform(#hello"));

Using the web package

npm i @rhcp/heading_hash_wasm_web

Import the package, initialize it, and log a transformed string.

import { default as init, transform } from "@rhcp/heading_hash_wasm_web";
await init();
console.log(transform("#hello"))

Please note that this example assumes you have a bundler which will resolve the name @rhcp/heading_hash_wasm_web.

🔬 Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox

wasm-pack test docs

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago