1 | {"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/schematics/schematics-core/utility/strings.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,IAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,IAAM,wBAAwB,GAAG,mBAAmB,CAAC;AACrD,IAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACnD,IAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,IAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC;AAFD,gCAEC;AAED;;;;;;;;;GASG;AACH,SAAgB,SAAS,CAAC,GAAY;IACpC,OAAO,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC;AAFD,8BAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG;SACP,OAAO,CACN,sBAAsB,EACtB,UAAC,MAAc,EAAE,UAAkB,EAAE,GAAW;QAC9C,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC,CACF;SACA,OAAO,CAAC,UAAU,EAAE,UAAC,KAAa,IAAK,OAAA,KAAK,CAAC,WAAW,EAAE,EAAnB,CAAmB,CAAC,CAAC;AACjE,CAAC;AATD,4BASC;AAED;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAA1B,CAA0B,CAAC;SACzC,IAAI,CAA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,CAAC;AACtC,CAAC;AAXD,kCAWC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_CAMELIZE_REGEXP = /(-|_|\\.|\\s)+(.)?/g;\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\nconst STRING_UNDERSCORE_REGEXP_2 = /-|\\s+/g;\n\n/**\n * Converts a camelized string into all lower case separated by underscores.\n *\n ```javascript\n decamelize('innerHTML'); // 'inner_html'\n decamelize('action_name'); // 'action_name'\n decamelize('css-class-name'); // 'css-class-name'\n decamelize('my favorite items'); // 'my favorite items'\n ```\n */\nexport function decamelize(str: string): string {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n}\n\n/**\n Replaces underscores, spaces, or camelCase with dashes.\n\n ```javascript\n dasherize('innerHTML'); // 'inner-html'\n dasherize('action_name'); // 'action-name'\n dasherize('css-class-name'); // 'css-class-name'\n dasherize('my favorite items'); // 'my-favorite-items'\n ```\n */\nexport function dasherize(str?: string): string {\n return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');\n}\n\n/**\n Returns the lowerCamelCase form of a string.\n\n ```javascript\n camelize('innerHTML'); // 'innerHTML'\n camelize('action_name'); // 'actionName'\n camelize('css-class-name'); // 'cssClassName'\n camelize('my favorite items'); // 'myFavoriteItems'\n camelize('My Favorite Items'); // 'myFavoriteItems'\n ```\n */\nexport function camelize(str: string): string {\n return str\n .replace(\n STRING_CAMELIZE_REGEXP,\n (_match: string, _separator: string, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n }\n )\n .replace(/^([A-Z])/, (match: string) => match.toLowerCase());\n}\n\n/**\n Returns the UpperCamelCase form of a string.\n\n ```javascript\n 'innerHTML'.classify(); // 'InnerHTML'\n 'action_name'.classify(); // 'ActionName'\n 'css-class-name'.classify(); // 'CssClassName'\n 'my favorite items'.classify(); // 'MyFavoriteItems'\n ```\n */\nexport function classify(str: string): string {\n return str\n .split('.')\n .map((part) => capitalize(camelize(part)))\n .join('.');\n}\n\n/**\n More general than decamelize. Returns the lower\\_case\\_and\\_underscored\n form of a string.\n\n ```javascript\n 'innerHTML'.underscore(); // 'inner_html'\n 'action_name'.underscore(); // 'action_name'\n 'css-class-name'.underscore(); // 'css_class_name'\n 'my favorite items'.underscore(); // 'my_favorite_items'\n ```\n */\nexport function underscore(str: string): string {\n return str\n .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')\n .replace(STRING_UNDERSCORE_REGEXP_2, '_')\n .toLowerCase();\n}\n\n/**\n Returns the Capitalized form of a string\n\n ```javascript\n 'innerHTML'.capitalize() // 'InnerHTML'\n 'action_name'.capitalize() // 'Action_name'\n 'css-class-name'.capitalize() // 'Css-class-name'\n 'my favorite items'.capitalize() // 'My favorite items'\n ```\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\n/**\n Returns the plural form of a string\n\n ```javascript\n 'innerHTML'.pluralize() // 'innerHTMLs'\n 'action_name'.pluralize() // 'actionNames'\n 'css-class-name'.pluralize() // 'cssClassNames'\n 'regex'.pluralize() // 'regexes'\n 'user'.pluralize() // 'users'\n ```\n */\nexport function pluralize(str: string): string {\n return camelize(\n [/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(\n (c, i) => (str = str.replace(c, `$1${'iv'[i] || ''}e`))\n ) && str + 's'\n );\n}\n\nexport function group(name: string, group: string | undefined) {\n return group ? `${group}/${name}` : name;\n}\n\nexport function featurePath(\n group: boolean | undefined,\n flat: boolean | undefined,\n path: string,\n name: string\n) {\n if (group && !flat) {\n return `../../${path}/${name}/`;\n }\n\n return group ? `../${path}/` : './';\n}\n"]} |