I hereby claim:
- I am craphtex on github.
- I am craphtex (https://keybase.io/craphtex) on keybase.
- I have a public key ASAh1sEH2fJ9FGgnVcKBM4pJHdsUWyS6zCXKZVlN1OGAzAo
To claim this, I am signing this object:
// Replaces {n} in a string with the nth following parameter. | |
const format = (text, ...values) => text.replace(/{([0-9]*)}/g, (m, i) => values[i] || m) | |
// Example 1 | |
console.log(format('Hello {0}! How\'s your {1}?', 'my dear', 'day been')) | |
// Output: Hello my dear! How's your day been? | |
// Example 2 | |
const list = ['the city', 'train', 'speed', 'convenient'] |
/** | |
* Converts an array to an array of n-tuples of its elements. | |
* | |
* To generate a gap between the n-tuples a stride can be set. The stride is | |
* offsetting the starting elements in the derived n-tuples. | |
* | |
* span = 3 and stride = 2 | |
* [1,2,3,4,5,6,7] -> [[1,2,3], [3,4,5], [5,6,7]] | |
* | |
* span = 2 and stride = 3 |
I hereby claim:
To claim this, I am signing this object: