/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/src/app/editor/terminal/command-validator.service.ts
36 строк
774 B
Matthieu Riegler
docs(docs-infra): Use `@Service` instead of `@Injectable`
23 апр 2026, 21:21
23 апр 2026, 21:21
7414352
Код
Авторство
О чём код?
/*! * @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 {Service} from '@angular/core'; export const ALLOWED_COMMAND_PREFIXES = [ 'ng serve', 'ng s', 'ng generate', 'ng g', 'ng version', 'ng v', 'ng update', 'ng test', 'ng t', 'ng e2e', 'ng e', 'ng add', 'ng config', 'ng new', ]; @Service() export class CommandValidator { // Method return true when the provided command is allowed to execute, otherwise return false. validate(command: string): boolean { return ALLOWED_COMMAND_PREFIXES.some( (prefix) => prefix === command || command.startsWith(`${prefix} `), ); } }