当前位置: 首页>>代码示例>>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;未经允许,请勿转载。