How to use fuzzaldrin - 10 common examples

To help you get started, we’ve selected a few fuzzaldrin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nmn / autocomplete-flow / src / index.js View on Github external
// const [cwd] = atom.project.relativizePath(file)
            options.cwd = path.dirname(file) //cwd

            try {
              const stringWithACToken = insertAutocompleteToken(currentContents, line, col)
              const result = await promisedExec(that.cmdString, args, options, stringWithACToken)
              if (!result || !result.length) {
                return []
              }
              // If it is just whitespace and punctuation, ignore it (this keeps us
              // from eating leading dots).
              const replacementPrefix = /^[\s.]*$/.test(prefix) ? '' : prefix
              const candidates = result.map(item => processAutocompleteItem(replacementPrefix, item))

              // return candidates
              return filter(candidates, replacementPrefix, { key: 'displayText' })
            } catch (e) {
              const errorM: string = String(e).toLowerCase()
              if ( errorM.includes('rechecking')
                || errorM.includes('launching')
                || errorM.includes('processing')
                || errorM.includes('starting')
                || errorM.includes('spawned')
                || errorM.includes('logs')
                || errorM.includes('initializing')
              ) {
                return []
              }
              console.log('[autocomplete-flow] ERROR:', e)
              return []
            }
          }
github alm-tools / alm / src / app / selectListView.tsx View on Github external
export function getFilteredItems(args: { items: T[], textify: (item: T) => string, filterValue: string }): T[] {

    // Store the items for each text value
    let textValueToItems: { [text: string]: T[] } = Object.create(null);
    args.items.forEach((item) => {
        let text = args.textify(item);
        if (!textValueToItems[text]) textValueToItems[text] = [];
        textValueToItems[text].push(item);
    })

    // Get the unique text values
    let textValues = Object.keys(utils.createMap(args.items.map(args.textify)));

    // filter them
    let filteredTextValues = fuzzyFilter(textValues, args.filterValue);

    return utils.selectMany(filteredTextValues.map((textvalue) => textValueToItems[textvalue]));
}
github h-hirokawa / atom-autocomplete-ansible / libs / provider.js View on Github external
function getFuzzySuggestions(data, prefix, key, suffix) {
  return filter(data, prefix, {key: key}).map(function(elm) {
    let cloned = Object.assign({}, elm);
    if (suffix && !/_$/.test(elm.text)) {
      cloned.displayText = elm.text;
      cloned.text += suffix;
    }
    cloned.replacementPrefix = prefix;
    return cloned;
  });
}
github Polymer / tools / packages / editor-service / src / language-server / definition-finder.ts View on Github external
this.connection.onWorkspaceSymbol(async(params) => {
      const analysis =
          await this.analyzer.analyzePackage({reason: 'get workspace symbols'});
      const symbols = this.findSymbols(analysis);
      return fuzzaldrin.filter(symbols, params.query, {key: 'name'});
    });
github mirumee / saleor-dashboard / src / discounts / components / DiscountCountrySelectDialog / DiscountCountrySelectDialog.tsx View on Github external
description: "search box placeholder"
                  })}
                  fullWidth
                />
              
              <hr>
              
                
                  
                
                
                  
                    {filter(countries, data.query, {
                      key: "country"
                    }).map(country =&gt; {
                      const isChecked = countrySelectionMap[country.code];

                      return (
                        
                          
                            {country.country}
github mirumee / saleor-dashboard / src / shipping / components / ShippingZoneCountriesAssignDialog / ShippingZoneCountriesAssignDialog.tsx View on Github external
{filter(countries, data.query, {
                      key: "country"
                    }).map(country =&gt; {
                      const isChecked = countrySelectionMap[country.code];

                      return (
                        
                          
                            {country.country}
github mirumee / saleor / saleor / static / dashboard-next / discounts / components / DiscountCountrySelectDialog / DiscountCountrySelectDialog.tsx View on Github external
placeholder={i18n.t("Search by country name", {
                      context: "country search input placeholder"
                    })}
                    fullWidth
                  /&gt;
                
                <hr>
                
                  
                    {i18n.t("Countries A to Z", {
                      context: "country selection"
                    })}
                  
                  
                      {filter(countries, data.query, {
                        key: "country"
                      }).map(country =&gt; {
                        const isChecked = countrySelectionMap[country.code];

                        return (
                          
                            
                              {country.country}
                            
                            
                              <table>
                    </table>
github marktext / marktext / src / renderer / codeMirror / index.js View on Github external
export const search = text => {
  const matchedLangs = filter(languages, text, { key: 'name' })
  return matchedLangs
    .map(({ name }) => getModeFromName(name))
    .filter(lang => !!lang)
}
github dfrankland / hyper-tab-icons / index.js View on Github external
const getIcon = title => {
  loadIcons();
  const processNameMatches = title.match(processNameRegex);
  let processName = 'shell';
  if (
    Array.isArray(processNameMatches) &&
    processNameMatches[processNameMatch]
  ) processName = processNameMatches[processNameMatch];
  const results = filter(classes, processName, { maxResults: 1 });
  const match = results.length === 0 ? 'shell' : results[0];
  return { class: icons[match], name: match };
};
github hughsk / autocomplete-webgl / provider-methods.js View on Github external
getSuggestions ({ editor, bufferPosition }) {
    const prefix = this.getPrefix(editor, bufferPosition)
    if (!prefix) return []

    const matches = fuzzaldrin(api, prefix, { key: 'name' })
    if (!matches.length) return []

    return matches.map(method => {
      const name = method.name

      return copy(this.methodCache[name] = (
        this.methodCache[name] || this.getMethodSuggestion(method)
      ))
    })
  }

fuzzaldrin

Fuzzy filtering and string scoring

MIT
Latest version published 10 years ago

Package Health Score

53 / 100
Full package analysis

Popular fuzzaldrin functions