Skip to content

Commit 0bb3a31

Browse files
committed
Simplify objectValues function
1 parent be3b4c6 commit 0bb3a31

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/dynamic-cache.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
var fs = require('fs');
44

55
function objectValues(obj) {
6-
if (typeof obj !== 'object') {
7-
return [];
6+
var values = [];
7+
if (typeof obj === 'object') {
8+
for (var key in obj) {
9+
if (obj.hasOwnProperty(key)) {
10+
values.push(obj[key]);
11+
}
12+
}
813
}
9-
10-
return Object.keys(obj).map(function (key) {
11-
return obj[key];
12-
});
14+
return values
1315
}
1416

1517
module.exports = DynamicCache;

0 commit comments

Comments
 (0)