Travis build: 537
This commit is contained in:
24
README.md
24
README.md
@ -409,6 +409,7 @@ average(1, 2, 3);
|
||||
* [`escapeHTML`](#escapehtml)
|
||||
* [`escapeRegExp`](#escaperegexp)
|
||||
* [`fromCamelCase`](#fromcamelcase)
|
||||
* [`indentString`](#indentstring)
|
||||
* [`isAbsoluteURL`](#isabsoluteurl)
|
||||
* [`isAnagram`](#isanagram)
|
||||
* [`isLowerCase`](#islowercase)
|
||||
@ -7453,6 +7454,29 @@ fromCamelCase('someJavascriptProperty', '_'); // 'some_javascript_property'
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### indentString
|
||||
|
||||
Indents each line in the provided string.
|
||||
|
||||
Use `String.replace` and a regular expression to add the character specified by `indent` `count` times at the start of each line.
|
||||
Omit the third parameter, `indent`, to use a default indentation character of `' '`.
|
||||
|
||||
```js
|
||||
const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count));
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
indentString('Lorem\nIpsum', 2); // ' Lorem\n Ipsum'
|
||||
indentString('Lorem\nIpsum', 2, '_'); // '__Lorem\n__Ipsum'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isAbsoluteURL
|
||||
|
||||
Returns `true` if the given string is an absolute URL, `false` otherwise.
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -6,8 +6,7 @@ Use `String.replace` and a regular expression to add the character specified by
|
||||
Omit the third parameter, `indent`, to use a default indentation character of `' '`.
|
||||
|
||||
```js
|
||||
const indentString = (str, count, indent = ' ') =>
|
||||
str.replace(/^/mg, indent.repeat(count));
|
||||
const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count));
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user