Skip to content

schwarzkopfb/extw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Extract words from a given string.

Resources

License

Stars

Watchers

Forks

Packages

No packages published