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