本文整理汇总了TypeScript中@angular-devkit/schematics.partitionApplyMerge函数的典型用法代码示例。如果您正苦于以下问题:TypeScript partitionApplyMerge函数的具体用法?TypeScript partitionApplyMerge怎么用?TypeScript partitionApplyMerge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了partitionApplyMerge函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('works with simple rules', done => {
const host = new virtualFs.test.TestHost({
'/test1': '',
'/test2': '',
});
const tree = new HostTree(host);
const predicate = (path: Path) => path.indexOf('1') != -1;
const ruleYes: Rule = (tree: Tree) => {
expect(tree.exists('/test1')).toBe(true);
expect(tree.exists('/test2')).toBe(false);
return empty();
};
const ruleNo: Rule = (tree: Tree) => {
expect(tree.exists('/test1')).toBe(false);
expect(tree.exists('/test2')).toBe(true);
return empty();
};
callRule(partitionApplyMerge(predicate, ruleYes, ruleNo), observableOf(tree), context)
.toPromise()
.then(result => {
expect(result.exists('/test1')).toBe(false);
expect(result.exists('/test2')).toBe(false);
})
.then(done, done.fail);
});
示例2: function
export default function (options: Schema): Rule {
const schematicsVersion = require('@angular-devkit/schematics/package.json').version;
const coreVersion = require('@angular-devkit/core/package.json').version;
return mergeWith(apply(url('./files'), [
partitionApplyMerge(
(p: Path) => !/\/src\/.*?\/files\//.test(p),
template({
...options as object,
coreVersion,
schematicsVersion,
dot: '.',
dasherize: strings.dasherize,
}),
),
move(options.name),
]));
}