/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular_devkit/schematics/src/tree/static.ts
40 строк
1 KB
Charles Lyding
refactor(@angular-devkit/schematics): add explicit return types to functions
01 май 2025, 02:50
01 май 2025, 02:50
2027d1b
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { SchematicsException } from '../exception/exception'; import { FilterHostTree, HostTree } from './host-tree'; import { FilePredicate, MergeStrategy, Tree } from './interface'; export function empty(): HostTree { return new HostTree(); } export function branch(tree: Tree): Tree { return tree.branch(); } export function merge( tree: Tree, other: Tree, strategy: MergeStrategy = MergeStrategy.Default, ): Tree { tree.merge(other, strategy); return tree; } export function partition(tree: Tree, predicate: FilePredicate<boolean>): [Tree, Tree] { if (tree instanceof HostTree) { return [ new FilterHostTree(tree, predicate), new FilterHostTree(tree, (path, entry) => !predicate(path, entry)), ]; } else { throw new SchematicsException('Tree type is not supported.'); } }