本文整理匯總了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;