Skip to content

Commit

Permalink
Merge pull request #979 from paldepind/master
Browse files Browse the repository at this point in the history
Path should return entire object for empty path
  • Loading branch information
buzzdecafe committed Mar 30, 2015
2 parents b7cfe5c + 80e6156 commit 8f38c9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/internal/_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* _path(['a', 'b'], {a: {b: 2}}); //=> 2
*/
module.exports = function _path(paths, obj) {
if (obj == null || paths.length === 0) {
if (obj == null) {
return;
} else {
var val = obj;
Expand Down
2 changes: 1 addition & 1 deletion test/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('path', function() {
j: ['J']
};
assert.strictEqual(R.path(['a', 'b', 'c'], obj), 100);
assert.strictEqual(R.path([], obj), undefined);
assert.strictEqual(R.path([], obj), obj);
assert.strictEqual(R.path(['a', 'e', 'f', '1'], obj), 101);
assert.strictEqual(R.path(['j', '0'], obj), 'J');
assert.strictEqual(R.path(['j', '1'], obj), undefined);
Expand Down
2 changes: 1 addition & 1 deletion test/pathEq.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('pathEq', function() {

it('accepts empty path', function() {
assert.strictEqual(R.pathEq([], 42, {a: 1, b: 2}), false);
assert.strictEqual(R.pathEq([], undefined, {a: 1, b: 2}), true);
assert.strictEqual(R.pathEq([], obj, obj), true);
});

});

0 comments on commit 8f38c9b

Please sign in to comment.