本文整理汇总了TypeScript中ramda.inc函数的典型用法代码示例。如果您正苦于以下问题:TypeScript inc函数的具体用法?TypeScript inc怎么用?TypeScript inc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inc函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: upToConditional
static upToConditional(n) {
const isModuloOf = mod => i => i % mod === 0;
const fb = R.cond([
[isModuloOf(15), R.always('fizzbuzz')],
[isModuloOf(5), R.always('buzz')],
[isModuloOf(3), R.always('fizz')],
[R.T, i => '' + i]
]);
return R.map(fb, R.range(1, R.inc(n)));
}
示例2: upToPipeline
static upToPipeline(n) {
const isModuloOf = mod => (i: any): boolean => i % mod === 0;
const apply = (m, s) => R.when(isModuloOf(m), R.always(s))
const fizzBuzz = apply(15, 'fizzbuzz')
const fizz = apply(3, 'fizz')
const buzz = apply(5, 'buzz')
const fizzbuzzPipeline = R.pipe(fizzBuzz, fizz, buzz, (i) => '' + i)
return R.map(fizzbuzzPipeline, R.range(1, R.inc(n)));
}
示例3: upToLookUp
static upToLookUp(n) {
const s = R.toString
const f = R.always('fizz');
const b = R.always('buzz');
const fb = R.always(f() + b());
const funs = [s, s, f, s, b, f, s, s, f, b, s, f, s, s, fb];
const selectFun: any = (n) => R.nth(R.modulo(R.dec(n), 15), funs);
const fizzBuzzify = (n) => R.call(selectFun(n), n);
return R.map(fizzBuzzify, R.range(1, R.inc(n)));
}
示例4:
const replaceBlanksWithNumber = (fb, idx) => R.isEmpty(fb) ? '' + R.inc(idx) : fb;