index.js
function sanitize(arr, opts) {
  return _.reduce(arr, function (acc, keywords) {
    keywords = keywords.split(' ').filter(Boolean);
    return acc.concat(keywords).map(function (keyword, i) {
      if (opts && opts.sanitize) {
        return opts.sanitize(keyword, i, keywords);
      }
      return keyword.toLowerCase();
    }).sort();
  }, []);
}
function sanitize(arr, opts) {
  return _.reduce(arr, function (acc, keywords) {
    keywords = keywords.split(' ').filter(Boolean);
    return acc.concat(keywords).map(function (keyword, i) {
      if (opts && opts.sanitize) {
        return opts.sanitize(keyword, i, keywords);
      }
      return keyword.toLowerCase();
    }).sort();
  }, []);
}
function sanitize ( arr , opts ) { return _ . reduce ( arr , function ( acc , keywords ) { keywords = keywords . split ( ' ' ) . filter ( Boolean ) ; return acc . concat ( keywords ) . map ( function ( keyword , i ) { if ( opts && opts . sanitize ) { return opts . sanitize ( keyword , i , keywords ) ; } return keyword . toLowerCase ( ) ; } ) . sort ( ) ; } , [ ] ) ; }
Clean up empty values, sentences, and non-word characters
that shouldn't polute the keywords.

@param  {Array} `arr`
@return {Array}
Clean up empty values sentences and non - word characters that shouldn t polute the keywords .