stuffwords
v1.0.0
Published
Get the extra words that decorate a base phrase
Downloads
4
Readme
stuffwords
Get the extra words that decorate a base phrase
The stuff words are the words that appear on a phrase decorating a "base". For example, consider the following pangram:
The quick brown fox jumps over the lazy dog
If our base is brown fox
, then the stuff words are:
- The
- quick
- jumps
- over
- the
- lazy
- dog
This module is inspired by the concept of stuff words from Scientific Seller Amazon Keyword Tool.
Installation
Install stuffwords
by running:
$ npm install --save stuffwords
Documentation
Object[] stuffwords.get(String base, String[] phrases)
This function retrieves the stuff words from a set of phrases given a base, and returns an array of objects that contain the following properties:
String .term
: The stuff word termNumber .counter
: How many times the stuff word appears in the phrase set
For example:
var stuffwords = require('stuffwords');
var words = stuffwords.get('laptop case', [
'laptop case for mac',
'laptop case for acer'
]);
console.log(words);
[
{
term: 'for',
counter: 2
},
{
term: 'mac',
counter: 1
},
{
term: 'acer',
counter: 1
}
]
Boolean stuffwords.matches(String base, String phrase, String term)
This function determines if the passed term is a stuff word of a phrase.
For example:
var stuffwords = require('stuffwords');
if (stuffwords.matches('laptop case', 'laptop case for mac', 'mac') {
console.log('This is true!');
}
Support
If you're having any problem, please raise an issue on GitHub and I'll be happy to help.
Tests
Run the test suite by doing:
$ npm test
Contribute
- Issue Tracker: github.com/jviotti/stuffwords/issues
- Source Code: github.com/jviotti/stuffwords
Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:
$ npm run-script lint
License
The project is licensed under the MIT license.