How to use the filter function from fuzzy

Find comprehensive JavaScript fuzzy.filter code examples handpicked from public code repositorys.

359
360
361
362
363
364
365
366
367
368
let split = path.normalize(file).split(path.sep).slice(0, 2);
let mockupPath = split.join('/');
let errorMsg = 'Invalid link in JSON at property /' + this.path.join('/') + ' with value ' + this.node + '. No such file exists in mockup at path.';
let invalidPath = this.node.replace('/redfish/v1/', mockupPath).split('/');
let files = Object.keys(linkToFile);
let possible = fuzzy.filter(path.join(...invalidPath), files).map(x => path2Redfish(x.string, true));
if(possible.length) {
  errorMsg += `\nPerhaps you meant one of:\n${possible.join('\n')}`;
}
assert.fail(errorMsg);
fork icon28
star icon66
watch icon45

+ 7 other calls in file

192
193
194
195
196
197
198
199
200
201
202
const linkServicesFront = ['workflowResourceService', '_', 'arxivarResourceService', 'arxivarUserServiceCreator', 'arxivarRouteService', 'arxivarDocumentsService', 'arxivarNotifierService', 'moment', '$timeout', '$document', '$window', '$rootScope', '$filter', '$q', '$uibModal'];


function searchService(answers, input) {
  input = input || '';
  return new Promise(function (resolve) {
    var fuzzyResult = fuzzy.filter(input, linkServices);
    var data = fuzzyResult.map(function (element) {
      return element.original;
    });
    resolve(data);
fork icon2
star icon5
watch icon7

+ 11 other calls in file

41
42
43
44
45
46
47
48
49
50
  pageSize: 10,
  highlight: true,
  searchable: true,
  source: (_answersSoFar, input = '') =>
    new Promise(function (resolve) {
      const fuzzyResult = fuzzy.filter(input, pkgNames);
      const data = fuzzyResult.map((element) => element.original);
      resolve(data);
    }),
},
fork icon0
star icon3
watch icon3

5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
  post: '</strong>',
  extract: function(d) { return this.getItemValue(d); }.bind(this)
};

var results = this.options.filter ?
  fuzzy.filter(this.query, this.data, options) :
  this.data.map(function(d) {
    return {
      original: d,
      string: this.getItemValue(d).replace(new RegExp('(' + this.query + ')', 'ig'), function($1, match) {
fork icon0
star icon2
watch icon2

+ 3 other calls in file

473
474
475
476
477
478
479
480
481
482
getOptionsForValue: function(value, options) {
  var result;
  if (this.props.filterOption) {
    result = options.filter((function(o) { return this.props.filterOption(value, o); }).bind(this));
  } else {
    result = fuzzy.filter(value, options).map(function(res) {
      return res.string;
    });
  }
  if (this.props.maxVisible) {
fork icon0
star icon0
watch icon7

+ 5 other calls in file