[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | /**
|
---|
| 9 | * Converts a camelized string into all lower case separated by underscores.
|
---|
| 10 | *
|
---|
| 11 | ```javascript
|
---|
| 12 | decamelize('innerHTML'); // 'inner_html'
|
---|
| 13 | decamelize('action_name'); // 'action_name'
|
---|
| 14 | decamelize('css-class-name'); // 'css-class-name'
|
---|
| 15 | decamelize('my favorite items'); // 'my favorite items'
|
---|
| 16 | ```
|
---|
| 17 |
|
---|
| 18 | @method decamelize
|
---|
| 19 | @param {String} str The string to decamelize.
|
---|
| 20 | @return {String} the decamelized string.
|
---|
| 21 | */
|
---|
| 22 | export declare function decamelize(str: string): string;
|
---|
| 23 | /**
|
---|
| 24 | Replaces underscores, spaces, or camelCase with dashes.
|
---|
| 25 |
|
---|
| 26 | ```javascript
|
---|
| 27 | dasherize('innerHTML'); // 'inner-html'
|
---|
| 28 | dasherize('action_name'); // 'action-name'
|
---|
| 29 | dasherize('css-class-name'); // 'css-class-name'
|
---|
| 30 | dasherize('my favorite items'); // 'my-favorite-items'
|
---|
| 31 | ```
|
---|
| 32 |
|
---|
| 33 | @method dasherize
|
---|
| 34 | @param {String} str The string to dasherize.
|
---|
| 35 | @return {String} the dasherized string.
|
---|
| 36 | */
|
---|
| 37 | export declare function dasherize(str: string): string;
|
---|
| 38 | /**
|
---|
| 39 | Returns the lowerCamelCase form of a string.
|
---|
| 40 |
|
---|
| 41 | ```javascript
|
---|
| 42 | camelize('innerHTML'); // 'innerHTML'
|
---|
| 43 | camelize('action_name'); // 'actionName'
|
---|
| 44 | camelize('css-class-name'); // 'cssClassName'
|
---|
| 45 | camelize('my favorite items'); // 'myFavoriteItems'
|
---|
| 46 | camelize('My Favorite Items'); // 'myFavoriteItems'
|
---|
| 47 | ```
|
---|
| 48 |
|
---|
| 49 | @method camelize
|
---|
| 50 | @param {String} str The string to camelize.
|
---|
| 51 | @return {String} the camelized string.
|
---|
| 52 | */
|
---|
| 53 | export declare function camelize(str: string): string;
|
---|
| 54 | /**
|
---|
| 55 | Returns the UpperCamelCase form of a string.
|
---|
| 56 |
|
---|
| 57 | ```javascript
|
---|
| 58 | 'innerHTML'.classify(); // 'InnerHTML'
|
---|
| 59 | 'action_name'.classify(); // 'ActionName'
|
---|
| 60 | 'css-class-name'.classify(); // 'CssClassName'
|
---|
| 61 | 'my favorite items'.classify(); // 'MyFavoriteItems'
|
---|
| 62 | ```
|
---|
| 63 |
|
---|
| 64 | @method classify
|
---|
| 65 | @param {String} str the string to classify
|
---|
| 66 | @return {String} the classified string
|
---|
| 67 | */
|
---|
| 68 | export declare function classify(str: string): string;
|
---|
| 69 | /**
|
---|
| 70 | More general than decamelize. Returns the lower\_case\_and\_underscored
|
---|
| 71 | form of a string.
|
---|
| 72 |
|
---|
| 73 | ```javascript
|
---|
| 74 | 'innerHTML'.underscore(); // 'inner_html'
|
---|
| 75 | 'action_name'.underscore(); // 'action_name'
|
---|
| 76 | 'css-class-name'.underscore(); // 'css_class_name'
|
---|
| 77 | 'my favorite items'.underscore(); // 'my_favorite_items'
|
---|
| 78 | ```
|
---|
| 79 |
|
---|
| 80 | @method underscore
|
---|
| 81 | @param {String} str The string to underscore.
|
---|
| 82 | @return {String} the underscored string.
|
---|
| 83 | */
|
---|
| 84 | export declare function underscore(str: string): string;
|
---|
| 85 | /**
|
---|
| 86 | Returns the Capitalized form of a string
|
---|
| 87 |
|
---|
| 88 | ```javascript
|
---|
| 89 | 'innerHTML'.capitalize() // 'InnerHTML'
|
---|
| 90 | 'action_name'.capitalize() // 'Action_name'
|
---|
| 91 | 'css-class-name'.capitalize() // 'Css-class-name'
|
---|
| 92 | 'my favorite items'.capitalize() // 'My favorite items'
|
---|
| 93 | ```
|
---|
| 94 |
|
---|
| 95 | @method capitalize
|
---|
| 96 | @param {String} str The string to capitalize.
|
---|
| 97 | @return {String} The capitalized string.
|
---|
| 98 | */
|
---|
| 99 | export declare function capitalize(str: string): string;
|
---|
| 100 | /**
|
---|
| 101 | * Calculate the levenshtein distance of two strings.
|
---|
| 102 | * See https://en.wikipedia.org/wiki/Levenshtein_distance.
|
---|
| 103 | * Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming
|
---|
| 104 | * version).
|
---|
| 105 | *
|
---|
| 106 | * @param a String a.
|
---|
| 107 | * @param b String b.
|
---|
| 108 | * @returns A number that represents the distance between the two strings. The greater the number
|
---|
| 109 | * the more distant the strings are from each others.
|
---|
| 110 | */
|
---|
| 111 | export declare function levenshtein(a: string, b: string): number;
|
---|