當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。