extw

1.2.1 • Public • Published

view on npm downloads per month node version build status test coverage license

extw

Tiny utility that extracts words from a given string and caches parsed result lists.

Usage

 
const words = require('extw')
 
words('  Buggy/is, my  :beautiful&cat.') // [ 'Buggy', 'is', 'my', 'beautiful', 'cat' ]
 

API

 
const extw = require('extw')
 
typeof extw === 'function'
 
extw('string')    // returns a string array
extw([ 'array' ]) // returns the given array untouched
extw(null)        // returns an empty array
extw(true)        // raises an assert.AssertionError
 
extw('string', null) // disable cache for _this_ call
extw('string', {})   // use the given object as cache for _this_ call
 
typeof extw.cache === 'object'
 
extw.cache = {}      // reset cache
extw.cache = false   // disable cache
extw.cache = 'error' // raises an assert.AssertionError
 
extw.regExp instanceof RegExp === true
 
extw.regExp = /a+/g   // override word match regexp
extw.regExp = 'error' // raises an assert.AssertionError
 
typeof extw.version === 'string' // returns the version string from package manifest
 

Installation

With npm:

npm install extw

License

MIT

Package Sidebar

Install

npm i extw

Weekly Downloads

11

Version

1.2.1

License

MIT

Last publish

Collaborators

  • schwarzkopfb