mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Ensure _.zipObject skips falsey elements in a given two dimensional array.
Former-commit-id: 31ce7e65aee98cbed477276ae9115b33fd10c6ea
This commit is contained in:
@@ -4561,7 +4561,7 @@
|
||||
var key = keys[index];
|
||||
if (values) {
|
||||
result[key] = values[index];
|
||||
} else {
|
||||
} else if (key) {
|
||||
result[key[0]] = key[1];
|
||||
}
|
||||
}
|
||||
|
||||
11
test/test.js
11
test/test.js
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user