Primeiro commit do projeto Angular
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.htmlSelectorRe = void 0;
|
||||
exports.validateHtmlSelector = validateHtmlSelector;
|
||||
exports.validateClassName = validateClassName;
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
// Must start with a letter, and must contain only alphanumeric characters or dashes.
|
||||
// When adding a dash the segment after the dash must also start with a letter.
|
||||
exports.htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*((:?-[0-9]+)*|(:?-[a-zA-Z][.0-9a-zA-Z]*(:?-[0-9]+)*)*)$/;
|
||||
// See: https://github.com/tc39/proposal-regexp-unicode-property-escapes/blob/fe6d07fad74cd0192d154966baa1e95e7cda78a1/README.md#other-examples
|
||||
const ecmaIdentifierNameRegExp = /^(?:[$_\p{ID_Start}])(?:[$_\u200C\u200D\p{ID_Continue}])*$/u;
|
||||
function validateHtmlSelector(selector) {
|
||||
if (selector && !exports.htmlSelectorRe.test(selector)) {
|
||||
throw new schematics_1.SchematicsException(`Selector "${selector}" is invalid.`);
|
||||
}
|
||||
}
|
||||
function validateClassName(className) {
|
||||
if (!ecmaIdentifierNameRegExp.test(className)) {
|
||||
throw new schematics_1.SchematicsException(`Class name "${className}" is invalid.`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=validation.js.map
|
||||
Reference in New Issue
Block a user