當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fuzzaldrin-plus.match函數代碼示例

本文整理匯總了TypeScript中fuzzaldrin-plus.match函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript match函數的具體用法?TypeScript match怎麽用?TypeScript match使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了match函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: String

    .map((item): IMatch<T> => {
      const key: string =
        typeof getKey === 'function'
          ? (getKey as KeyFunction<T>)(item)
          : String(item[getKey])

      return {
        score: score(key, query, maxScore),
        item,
        matches: fuzzAldrin.match(key, query, undefined, options),
      }
    })
開發者ID:whyamei,項目名稱:desktop,代碼行數:12,代碼來源:fuzzy-find.ts

示例2:

fz.filter(candidates, 'install')
fz.filter(candidates, 'install', options)
fz.filter(candidates, 'install', filterOptions)
fz.filter(objectCandidates, 'install', { key: 'foo' })

const preparedQuery: fz.Query = fz.prepareQuery('install')

fz.score('Maybe', 'me')
fz.score('Maybe', 'me', undefined)
fz.score('Maybe', 'me', null)
fz.score('Maybe', 'me', {})
fz.score('Maybe', 'me', { allowErrors: true })
fz.score('Application: Install Update', 'install')
fz.score('Application: Install Update', 'install', { preparedQuery })

fz.match('Maybe', 'me')
fz.match('Application: Install Update', 'install')
fz.match('Application: Install Update', 'install', { preparedQuery })

fz.wrap('Maybe', 'me')

//
// Complex filter cases, using all the options
// ----------------------------------------------------------------------

fz.filter(['Maybe', 'Me'], 'me')
fz.filter(['Maybe', 'Me'], 'me', undefined)
fz.filter(['Maybe', 'Me'], 'me', null)
fz.filter(['Maybe', 'Me'], 'me', {})
fz.filter(['Maybe', 'Me'], 'me', { allowErrors: true })
fz.filter(['Maybe', 'Me'], 'me', { key: 'key' })
開發者ID:adidahiya,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:fuzzaldrin-plus-tests.ts

示例3:

 itemTextArray.forEach(text => {
   matches.push(fuzzAldrin.match(text, query))
 })
開發者ID:ghmoore,項目名稱:desktop,代碼行數:3,代碼來源:fuzzy-find.ts

示例4:

import * as fz from "fuzzaldrin-plus";

const candidates = [
    'Find And Replace: Select All',
    'Settings View: Uninstall Packages',
    'Settings View: View Installed Themes',
    'Application: Install Update',
    'Install'
]
const objectCandidates = candidates.map(s => ({ foo: s }));

fz.filter(candidates, 'install');
fz.filter(objectCandidates, 'install', { key: 'foo' });

const prepQuery = fz.prepQuery('install');
fz.score('Application: Install Update', 'install');
fz.score('Application: Install Update', 'install', prepQuery);

fz.match('Application: Install Update', 'install');
fz.match('Application: Install Update', 'install', prepQuery);
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:20,代碼來源:fuzzaldrin-plus-tests.ts


注:本文中的fuzzaldrin-plus.match函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。