本文整理汇总了TypeScript中transducers-js.into函数的典型用法代码示例。如果您正苦于以下问题:TypeScript into函数的具体用法?TypeScript into怎么用?TypeScript into使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了into函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: intoExample
function intoExample () {
var inc = function(n: number) { return n+1; };
var isEven = function(n: number) { return n % 2 == 0; };
var apush = function(arr: number[], x: number) { arr.push(x); return arr; };
var xf = t.comp(t.map(inc),t.filter(isEven));
t.into([], xf, [1,2,3,4]); // [2,4]
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:7,代码来源:transducers-js-tests.ts
示例2: mapcatExample
function mapcatExample () {
var reverse = function(arr: number[]) {
var arr: number[] = Array.prototype.slice.call(arr, 0);
arr.reverse();
return arr;
};
var xf = t.mapcat(reverse);
t.into([], xf, [[3,2,1],[6,5,4]]); // [1,2,3,4,5,6]
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:9,代码来源:transducers-js-tests.ts
示例3: mapExample
function mapExample () {
var inc = function(n: number) { return n+1; };
var xf = t.map(inc);
t.into([], xf, [1,2,3]); // [2,3,4]
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:5,代码来源:transducers-js-tests.ts
示例4: partitionAllExample
function partitionAllExample () {
var xf = t.partitionAll(3);
t.into([], xf, [0,1,2,3,4,5]); // [[0,1,2],[3,4,5]]
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例5: partitionByExample
function partitionByExample () {
var xf = t.partitionBy(function(x: string|number) { return typeof x == "string"; });
t.into([], xf, [0,1,"foo","bar",2,3,"bar","baz"]); // [[0,1],["foo","bar"],[2,3],["bar","baz"]];
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例6: mapcatExample
function mapcatExample() {
const xf = t.mapcat(reverse);
t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6]
}
开发者ID:MrBigDog2U,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例7: takeWhileExample
function takeWhileExample () {
var xf = t.takeWhile(function(n) { return n < 3; });
t.into([], xf, [0,1,2,3,4,5]); // [0,1,2];
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例8: keepIndexedExample
function keepIndexedExample () {
var xf = t.keepIndexed(function(i: number, x: string|number) { if (typeof x == "string") return "cool"; });
t.into([], xf, [0,1,"foo",3,4,"bar"]); // ["foo","bar"]
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例9: partitionByExample
function partitionByExample() {
const xf = t.partitionBy((x: string|number) => typeof x === "string");
t.into([], xf, [0, 1, "foo", "bar", 2, 3, "bar", "baz"]); // [[0, 1], ["foo", "bar"], [2, 3], ["bar", "baz"]];
}
开发者ID:MrBigDog2U,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
示例10: dropWhileExample
function dropWhileExample() {
const xf = t.dropWhile(n => n < 3);
t.into([], xf, [0, 1, 2, 3, 4, 5]); // [3, 4, 5];
}
开发者ID:MrBigDog2U,项目名称:DefinitelyTyped,代码行数:4,代码来源:transducers-js-tests.ts
注:本文中的transducers-js.into函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论