(require("extensions/snapshot/dedent"))(text) → {string}
Used to remove indentation from a text. Usefull with multine string in backticks.
Two way to use it : `
My text
Another line
Another line again
`
the result text will be :
"My text
Another line
Another line again"
In this case, alignment is done on the length of the first character that is not a space or a tab of all lines
Or
Another way : `
"""
My text
Another line
Another line again
"""
`
the result text will be :
" My text
Another line
Another line again"
In this case, alignment is donne on the spaces or tab before """
Warning : First line and last line will always be ignored
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
Returns:
- Type:
-
string
Methods
(inner) getSpacesLength(text) → {number}
Extract spaces length
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
Returns:
- Type:
-
number
length tab and space before first char