Ensure _.zipObject skips falsey elements in a given two dimensional array.

Former-commit-id: 31ce7e65aee98cbed477276ae9115b33fd10c6ea
This commit is contained in:
John-David Dalton
2013-07-18 09:09:46 -07:00
parent 49c032315c
commit 2b2c8e6b82
2 changed files with 12 additions and 1 deletions

View File

@@ -4561,7 +4561,7 @@
var key = keys[index];
if (values) {
result[key] = values[index];
} else {
} else if (key) {
result[key[0]] = key[1];
}
}

View File

@@ -3576,6 +3576,17 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.zipObject');
(function() {
test('should skip falsey elements in a given two dimensional array', function() {
var actual = _.zipObject([['a', 1], ['b', 2]].concat(falsey));
deepEqual(actual, { 'a': 1, 'b': 2 });
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash(...).shift');
(function() {