extractwords

1.2.0 • Public • Published

extractwords Build Status

Install

$ npm install extractwords

Usage

const extractwords = require('extractwords');
 
extractwords('Good Morning, how are you?');
//=> ['Good', 'Morning', 'how', 'are', 'you']
 
extractwords("He didn't pay for his meal m'aam");
//=> ['He', "didn't", 'pay', 'for', 'his', 'meal', "m'aam"]
 
extractwords("17651Hello*&!(*2I'm_++`~gOOd 2");
//=> ['Hello', "I'm", 'gOOd']
 
extractwords('Good morning, how are you?', {lowercase: true});
//=> ['good', 'morning', 'how', 'are', 'you']
 
extractwords('Good Morning. how are you?', {punctuation: true});
//=> ['Good', 'Morning.', 'how', 'are', 'you?']
 
extractwords('I . am ... go0d 2', {punctuation: true});
//=> ['I', '.', 'am', '...', 'go0d', '2']

API

extractwords(str, [options])

str

Type: string

Text containing words to be extracted.

options

Type: object

lowercase

Type: boolean
Default: false

If true, all words returned are lowercased.

punctuation

Type: boolean
Default: false

If true, all punctuation is retained.

Package Sidebar

Install

npm i extractwords

Weekly Downloads

167

Version

1.2.0

License

MIT

Unpacked Size

3.36 kB

Total Files

4

Last publish

Collaborators

  • f-a-r-a-z