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


TypeScript ramda.split函數代碼示例

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


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

示例1: exec

    exec('git branch --no-color -a', options, (error, stdout, stderr) => {
      if (stderr || error) return reject(stderr || error);

      const getCurrentBranch = R.compose(
        R.trim,
        R.replace('*', ''),
        R.find(line => line.startsWith('*')),
        R.split('\n')
      );

      const processBranches = R.compose(
        R.filter(br => stdout.match(new RegExp(`remotes\/.*\/${br}`))),
        R.uniq
      );

      const currentBranch = getCurrentBranch(stdout);
      const branches = processBranches([currentBranch, defaultBranch]);

      return excludeCurrentRevision
        ? resolve(branches)
        : getCurrentRevision(exec, projectPath)
            .then((currentRevision) => {
              return resolve(branches.concat(currentRevision));
            });
    });
開發者ID:d4rkr00t,項目名稱:vscode-open-in-github,代碼行數:25,代碼來源:common.ts

示例2: validateCards

module.exports = (
  message: string,
  callback: (error: Error, result: string) => void
) => {
  const cards = validateCards(split('\n', message))
  callback(null, cards.join('\n') + '\n')
}
開發者ID:jamespepplinkhouse,項目名稱:creditcardchecker-node,代碼行數:7,代碼來源:worker.ts

示例3: getAllRemotes

export function getAllRemotes(exec, projectPath: string) : Promise<string[]> {
  const process = R.compose(
    R.uniq,
    R.map(R.head),
    R.map(R.split(' ')),
    R.reject(R.isEmpty),
    R.map(R.last),
    R.map(R.split(/\t/)),
    R.split('\n')
  );

  return new Promise((resolve, reject) => {
    exec('git remote -v', { cwd: projectPath }, (error, stdout, stderr) => {
      if (stderr || error) return reject(stderr || error);
      resolve(process(stdout));
    });
  });
}
開發者ID:d4rkr00t,項目名稱:vscode-open-in-github,代碼行數:18,代碼來源:common.ts

示例4:

export const searchKeywordMatcher = (searchKeyword: string, title: string) => {
  const lowerCaseTitle = title.toLowerCase()
  return R.compose(
    R.all((x: string) => lowerCaseTitle.includes(x)),
    R.filter(Boolean),
    R.split(' '),
    R.toLower
  )(searchKeyword)
}
開發者ID:foray1010,項目名稱:Popup-my-Bookmarks,代碼行數:9,代碼來源:getSearchResult.ts

示例5: compose

getIdOrNullFor = type => compose(
  ifElse(isNil, always(null), compose(
    ifElse(
      contains(type),
      compose<string, string[], string, number, Record<string, number>>(
        objOf(`${type}_id`), Number, last, split('-'),
      ),
      always(null),
    ),
  )),
);
開發者ID:displague,項目名稱:manager,代碼行數:11,代碼來源:createDevicesFromStrings.ts

示例6: readDownSQL

export function readDownSQL(migration: Migration): Promise<string> {
  if (migration.split) {
    return fs.readFileAsync(migration.downPath, {encoding: 'utf8'})
      .then(R.trim);
  }
  return fs.readFileAsync(migration.path, {encoding: 'utf8'})
    .then(R.split(MIGRATION_SQL_SPLIT_REGEXP))
    .tap(R.partial(assertSQLSections, migration))
    .then(R.nth(1))
    .then(R.trim);
}
開發者ID:programble,項目名稱:careen,代碼行數:11,代碼來源:files.ts

示例7: split

const createTypeRecord = (value?: string): null | DiskRecord | VolumeRecord => {
  if (isNil(value) || value === 'none') {
    return null;
  }

  // Given: volume-123
  const [type, id] = split('-', value); // -> [volume, 123]

  const key = `${type}_id`; // -> `volume_id`
  const idAsNumber = Number(id); // -> 123

  return objOf(key, idAsNumber); // -> { volume_id: 123 }
};
開發者ID:linode,項目名稱:manager,代碼行數:13,代碼來源:createDevicesFromStrings.ts

示例8: head

export const pinNumbers = (observed: string): Array<String> => {
  const lookUp = ['08', '124', '1235', '236', '1457', '24568', '3569', '478', '57890', '689'];

  let obsHead: string = head(observed);

  const heads = lookUp[obsHead];

  if (observed.length <= 1)
    return split('', heads);

  const result = [];
  for (const h of heads) {
    for (const t of pinNumbers(drop(1, observed))) {
      result.push(h + t)
    }
  }
  return result
};
開發者ID:sprengerjo,項目名稱:katas_js,代碼行數:18,代碼來源:pin_numbers.ts

示例9: split

const cookieKey = (cookie: string) => compose<string, string[], string>(head, split('='))(cookie)
開發者ID:vtex,項目名稱:apps-client-node,代碼行數:1,代碼來源:setCookie.ts

示例10: countBy

const countChars = (w: string) => countBy(split('') as any, w as any);
開發者ID:kerlends,項目名稱:word-solver,代碼行數:1,代碼來源:solver.worker.ts


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