src/index.js
/**
     * Returns a startFn function that returns a random word, matching the regexp, to start the sentence with
     *
     * @param {RegExp} regexp
     * @return {startFn} function that returns a random word, matching the regexp, to start the sentence with
     */
Returns a startFn function that returns a random word, matching the regexp, to start the sentence with
@param {RegExp} regexp
@return {startFn} function that returns a random word, matching the regexp, to start the sentence with
Returns a startFn function that returns a random word matching the regexp to start the sentence with @param { RegExp } regexp @return { startFn } function that returns a random word matching the regexp to start the sentence with
static matchingRegExp(regexp) {
        if (!(regexp instanceof RegExp)) {
            throw new Error("Argument must be a RegExp object");
        }
        return model => {
            const matches = Object.keys(model).filter(w => w.match(regexp) !== null);
            return matches[~~(Math.random() * matches.length)];
        }
    }
static matchingRegExp ( regexp ) { if ( ! ( regexp instanceof RegExp ) ) { throw new Error ( "Argument must be a RegExp object" ) ; } return model => { const matches = Object . keys ( model ) . filter ( w => w . match ( regexp ) !== null ) ; return matches [ ~ ~ ( Math . random ( ) * matches . length ) ] ; } }
Returns a startFn function that returns a random word, matching the regexp, to start the sentence with
 @param {RegExp} regexp
 @return {startFn} function that returns a random word, matching the regexp, to start the sentence with
Returns a startFn function that returns a random word matching the regexp to start the sentence with @param { RegExp } regexp @return { startFn } function that returns a random word matching the regexp to start the sentence with