We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1f180fb + cd6bb48 commit 6b2cf57Copy full SHA for 6b2cf57
test/utility.js
@@ -37,6 +37,8 @@
37
test('property', function() {
38
var moe = {name : 'moe'};
39
equal(_.property('name')(moe), 'moe', 'should return the property with the given name');
40
+ equal(_.property('name')(null), undefined, 'should return undefined for null values');
41
+ equal(_.property('name')(undefined), undefined, 'should return undefined for undefined values');
42
});
43
44
test('random', function() {
underscore.js
@@ -1190,7 +1190,7 @@
1190
1191
_.property = function(key) {
1192
return function(obj) {
1193
- return obj[key];
+ return obj == null ? void 0 : obj[key];
1194
};
1195
1196
0 commit comments