Permalink
Browse files

Further simplify `getProperties`

Closes #4.
  • Loading branch information...
1 parent 18eca3d commit b9f638c75f5d6a4193610aa30b46392419df6725 @angus-c angus-c committed with Dec 2, 2013
Showing with 3 additions and 5 deletions.
  1. +3 −5 tpyo.js
View
@@ -8,18 +8,16 @@
function getProperties(object, map) {
// TODO: should we support `__proto__`?
map || (map = {});
- var proto = Object.getPrototypeOf(object) || object.prototype;
Object.getOwnPropertyNames(object).forEach(function(property) {
map[property] = true;
});
- if (!proto) {
- return map;
+ var proto = object.__proto__;
+ if (proto) {
+ getProperties(proto, map);
}
- getProperties(proto, map);
-
return Object.keys(map);
}

0 comments on commit b9f638c

Please sign in to comment.