1.2.1 • Published 8 years ago

extw v1.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago