Skip to content

Commit

Permalink
Don't add duplicate entries in id#methods().
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Aug 26, 2011
1 parent 6cf577c commit b3cee63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion id.js
Expand Up @@ -133,7 +133,11 @@ proto.methods = function methods (maxDepth, sort) {
, md = maxDepth || 1
, depth = 0
while (c && depth++ < md) {
rtn.push.apply(rtn, c.getInstanceMethods())
var ms = c.getInstanceMethods()
, i = ms.length
while (i--) {
if (!~rtn.indexOf(ms[i])) rtn.push(ms[i]);
}
c = c.getSuperclass()
}
return sort === false ? rtn : rtn.sort()
Expand Down

0 comments on commit b3cee63

Please sign in to comment.