Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.19 KB

README.md

File metadata and controls

51 lines (38 loc) · 1.19 KB

fnmatch

Updated clone of kballards golang fnmatch gist (https://gist.github.com/kballard/272720)

JavaScript interopability

This module has javascript<>go interop via wasm

Usage

npm i @slashid/fnmatch
// or
yarn add @slashid/fnmatch
// or
pnpm add @slashid/fnmatch

You must load tinygo wasm runtime before this library.

You have two options for getting the runtime:

  1. Get it from your tinygo install:
    • cp $(tinygo env TINYGOROOT)/targets/wasm_exec.js .
  2. We ship a compatible wasm_exec.js with this library for your convenience:
    • @slashid/fnmatch/wasm_exec.js
<script src="wasm_exec.js"></script>
<script src="your_code.js">></script>
import { fnmatch } from '@slashid/fnmatch'

fnmatch.Match("*yes.com", "[email protected]", fnmatch.FNM_CASEFOLD) // true
fnmatch.Match("*yes.com", "[email protected]", fnmatch.FNM_CASEFOLD) // false

Contributing

Build

This library is built using tinygo, Rollup and @rollup/plugin-wasm.

npm run build

Publish dry-run

For you convenience there is a yalc publishing helper.

npm run publish:yalc