Edits:

1. s/Haskell/Swift/g
2. Most of my utility has been in things like random data.

Now that I take a second look at this, maybe it's better as just a
utility function, not in the standard. (There isn't really anything
this could provide that aren't possible otherwise, and it's not as
broad of a use case as, say, `Array.prototype.map` or `Math.random`.)

-----

Isiah Meadows
[email protected]

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Sun, Mar 25, 2018 at 9:52 PM, Isiah Meadows <[email protected]> wrote:
> I like this idea, and it has plenty of precedent in other languages
> (Python, Haskell, Clojure, etc.). It's more useful for arrays in my
> experience than even for strings.
> -----
>
> Isiah Meadows
> [email protected]
>
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
>
>
> On Sun, Mar 25, 2018 at 2:27 PM, Cyril Auburtin
> <[email protected]> wrote:
>> String and Array share a few methods.
>>
>> I think `repeat` could exist for Array as well
>>
>> At the moment are other more verbose ways to do so:
>>
>> - `Array.from({length: n}, () => 'foo')`
>> - `Array(n).fill('foo')`
>> - `[].concat(...Array.from({length: 3}, () => ['x', 'y']))`
>> - `[].concat(...Array(3).fill(['x', 'y']))`
>>
>> so with repeat it would just be;
>>
>> - `['foo'].repeat(n)`
>> - `['x', 'y'].repeat(3)`
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to