mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Ensure _.times floors n float values.
This commit is contained in:
@@ -11651,7 +11651,7 @@
|
|||||||
* // => also invokes `mage.castSpell(n)` three times
|
* // => also invokes `mage.castSpell(n)` three times
|
||||||
*/
|
*/
|
||||||
function times(n, iteratee, thisArg) {
|
function times(n, iteratee, thisArg) {
|
||||||
n = +n;
|
n = floor(n);
|
||||||
|
|
||||||
// Exit early to avoid a JSC JIT bug in Safari 8
|
// Exit early to avoid a JSC JIT bug in Safari 8
|
||||||
// where `Array(0)` is treated as `Array(1)`.
|
// where `Array(0)` is treated as `Array(1)`.
|
||||||
|
|||||||
@@ -15544,6 +15544,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should floor `n` float values', 1, function() {
|
||||||
|
var actual = _.times(2.4, _.indentify);
|
||||||
|
deepEqual(actual, [0, 1]);
|
||||||
|
});
|
||||||
|
|
||||||
test('should provide the correct `iteratee` arguments', 1, function() {
|
test('should provide the correct `iteratee` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user