本文整理汇总了TypeScript中ramda.nth函数的典型用法代码示例。如果您正苦于以下问题:TypeScript nth函数的具体用法?TypeScript nth怎么用?TypeScript nth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nth函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: listMigrations
export function listMigrations(directory: string): Promise<Migration[]> {
return fs.readdirAsync(directory)
.map(R.match(MIGRATION_FILE_REGEXP))
.filter(R.identity)
.then(R.groupBy(R.nth<string>(1)))
.then(R.mapObj(R.partial(matchesToMigration, directory)))
.then(R.values)
.then(R.sortBy((migration: Migration) => migration.id));
}
开发者ID:programble,项目名称:careen,代码行数:9,代码来源:files.ts
示例2: 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
示例3: compose
import { NoContent } from './no-content';
import { DataResolver } from './app.resolver';
import { routes as blogRoutes, asyncRoutes as blogAsyncRoutes } from './blog/blog.routing';
import { prop, compose, split, find, trim, equals, nth, ifElse, identity } from 'ramda';
export const appNavLinks: NavigationConfig = [
...Pages.navLinks,
...Layouts.navLinks,
...Authentication.navLinks,
];
const layout = compose(
ifElse(identity, compose(nth(1), split('=')), identity),
find(compose(equals('layout'), trim, nth(0), split('='))),
split(';')
)(document.cookie);
const layouts = {
'horizontal': HorizontalLayout,
'vertical' : VerticalLayout
};
export const routes: RouterConfig = [
{
path: '',
component: layouts[layout],
children: [
...Pages.routes,
开发者ID:the-fool,项目名称:attacus-atlas,代码行数:31,代码来源:app.routes.ts
示例4: contains
import * as R from 'ramda'
const UtilsR = {
R,
//// [] ////
// contains :: a → [a] → Boolean
contains(val, list) {
return R.contains(val, list)
},
// nth :: Number → [a] → a | Undefined (head 0 /last -1)
nth(index, list) {
return R.nth(index, list)
},
// slice :: Number → Number → [a] → [a] (init / tail / take / takeLast)
slice(fromIndex, toIndex, list) {
return R.slice(fromIndex, toIndex, list)
},
// difference {a∣a∈xs ∩ a∉ys} :: [a] → [a] → [a]
difference(listA, listB) {
return R.difference(listA, listB)
},
// insert :: Number → a → [a] → [a] (append / prepend)
insert(insertIndex, val, list) {
return R.insert(insertIndex, val, list)
},
// update :: Number → a → [a] → [a]
update(index, val, list) {
return R.update(index, val, list)
},
开发者ID:stefaniepei,项目名称:react-redux-scaffold,代码行数:31,代码来源:ramda.ts
示例5: add
[isStrike, rolls => add(add(nth(1, rolls), nth(2, rolls)), bonus(drop(1, rolls)))],
开发者ID:sprengerjo,项目名称:katas_js,代码行数:1,代码来源:bowling_score_calculator.ts
示例6: nth
[isSpare, rolls => nth(2, rolls) + bonus(drop(2, rolls))],
开发者ID:sprengerjo,项目名称:katas_js,代码行数:1,代码来源:bowling_score_calculator.ts
示例7:
const selectFun: any = (n) => R.nth(R.modulo(R.dec(n), 15), funs);
开发者ID:sprengerjo,项目名称:katas_js,代码行数:1,代码来源:fizzbuzz.ts
注:本文中的ramda.nth函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论