当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript schematics.partitionApplyMerge函数代码示例

本文整理汇总了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);
  });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:29,代码来源:base_spec.ts

示例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),
  ]));
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:18,代码来源:factory.ts


注:本文中的@angular-devkit/schematics.partitionApplyMerge函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。