Format List
Formats a list of values into a given string using the $n
tags. By default, index 0 will replace the $0
tag, and it will go up by 1 from there (i.e. tags match indexes). It can be configured with the following options:
tagStr
- The string to use as the tag prefix
tagStart
- The number to start the tags from
indexStart
- The index to start from
- Allows regex results to be passed in without slicing (using a value of 1)
More info can be seen in the code docs.
Examples
formatList'hello $0', // -> 'hello world' formatList'hello $0, it is an $1 day today', // -> 'hello you, it is an alright day today' formatList'$1 $0', // -> 'hello world' formatList'foo $1 bar', , // -> 'foo baz bar' formatList'foo $0 bar', , // -> 'foo faz bar'