Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit e72a7a1

Browse files
committed
fix
1 parent 250ad4c commit e72a7a1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/utils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function isClass(obj) {
2121
}
2222

2323
function isGenerator(obj) {
24-
return obj[Symbol.iterator].name === "[Symbol.iterator]" &&
24+
return obj[Symbol.iterator] &&
25+
obj[Symbol.iterator].name === "[Symbol.iterator]" &&
2526
typeof obj.next === "function";
2627
}
2728

@@ -50,6 +51,14 @@ export function toJson(data, indent = 4) {
5051
}, indent);
5152
}
5253

54+
export function objectKeys(obj) {
55+
const result = [];
56+
for(const key in obj) {
57+
result.push(key);
58+
}
59+
return result;
60+
}
61+
5362
export function pprint(...obj) {
5463
print(...obj.map(o => toJson(o, 4)));
5564
}

0 commit comments

Comments
 (0)