本文整理匯總了TypeScript中angular2/src/change_detection/coalesce.coalesce函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript coalesce函數的具體用法?TypeScript coalesce怎麽用?TypeScript coalesce使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了coalesce函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should replace duplicate terminal records with" + " self records", () => {
var rs = coalesce([r("user", [], 0, 1, true), r("user", [], 0, 2, true)]);
expect(rs[1]).toEqual(new ProtoRecord(RECORD_TYPE_SELF, "self", null, [], null, 1, null, 2,
null, null, true, false));
});
示例2: it
it("should replace duplicate terminal records with self records", () => {
var rs = coalesce(
[r("user", [], 0, 1, {lastInBinding: true}), r("user", [], 0, 2, {lastInBinding: true})]);
expect(rs[1]).toEqual(new ProtoRecord(RecordType.SELF, "self", null, [], null, 1, null, 2,
null, null, true, false, false, false));
});
示例3: coalesce
() => {
var nullFunc = () => {};
var rs = coalesce([
r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(0, 0)}),
r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(0, 1)}),
r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(1, 0)}),
r(nullFunc, [], 0, 1, {directiveIndex: null}),
]);
expect(rs.length).toEqual(4);
});
示例4: coalesce
() => {
var rs = coalesce([
r("user", [], 0, 1),
r("first", [], 1, 2),
r("user", [], 0, 3),
r("last", [], 3, 4)
]);
expect(rs).toEqual([r("user", [], 0, 1), r("first", [], 1, 2), r("last", [], 1, 3)]);
});