lodash _.times
See original GitHub issueWhat about _.times function. There is es6 Array.from, which lets somewhat replicate that function.
let out = Array.from(Array(10), (_,x) => x);
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Lodash _.times() Method - GeeksforGeeks
The Lodash _.times() method Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with...
Read more >Lodash - times method
Lodash - times method, Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with...
Read more >Lodash Documentation
Creates a new array concatenating array with any additional arrays and/or values. Since. 4.0.0. Arguments. array (Array): The array to concatenate ...
Read more >The lodash _.times method as an alternative to loops, forEach.
The repeat method in lodash is a way to just repeat a string a bunch of times. It is less advanced then the...
Read more >index with lodash times method - javascript - Stack Overflow
I need to replicate a component "n" times. To do that I used the lodash method times . The problem is that I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@edysegura Not quite, lodash optionally takes a
iteratee
so OPs solution fits i think._.times(n, [iteratee=_.identity])
PR welcome!