Ensure _.flatten will flatten arguments objects.

Former-commit-id: 9ea8e40ff85b217a6497c9bbf91c9640211d9477
This commit is contained in:
John-David Dalton
2013-07-06 13:48:27 -07:00
parent bcb5eda7d8
commit 6a73b0820e
2 changed files with 95 additions and 65 deletions

View File

@@ -939,7 +939,13 @@
QUnit.module('lodash.flatten');
(function() {
var array = [{ 'a': [1, [2]] }, { 'a': [3] }];
var args = arguments,
array = [{ 'a': [1, [2]] }, { 'a': [3] }];
test('should flatten `arguments` objects', function() {
var actual = _.flatten([args, args]);
deepEqual(actual, [1, 2, 3, 1, 2, 3]);
});
test('should work with a `callback`', function() {
var actual = _.flatten(array, function(value) {
@@ -1000,7 +1006,7 @@
deepEqual(actual2, expected);
ok(4 in actual2);
});
}());
}(1, 2, 3));
/*--------------------------------------------------------------------------*/