Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(annotations): isClass annotation to leverage methods to be future…
Browse files Browse the repository at this point in the history
… compliant
  • Loading branch information
iammerrick committed Feb 1, 2015
1 parent 93efb35 commit 72c7ca0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function isClass(clsOrFunction) {
else if (clsOrFunction.name) {
return isUpperCase(clsOrFunction.name.charAt(0));
} else {
return Object.keys(clsOrFunction.prototype).length > 0;
var hasSymbol = Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(clsOrFunction.prototype).length > 0;

This comment has been minimized.

Copy link
@iammerrick

iammerrick Feb 1, 2015

Author Contributor

@caitp Does this properly address your concern?

This comment has been minimized.

Copy link
@caitp

caitp Feb 1, 2015

Contributor

I think it might make sense to just write a temporary utility function, like

var ownKeys = (this.Reflect && Reflect.ownKeys ? Reflect.ownKeys : function OwnKeys(O) {
  var keys = Object.getOwnPropertyNames(O);
  if (Object.getOwnPropertySymbols) return keys.concat(Object.getOwnPropertySymbols(O));
  return keys;
});

I mean, close enough

This comment has been minimized.

Copy link
@iammerrick

iammerrick Feb 1, 2015

Author Contributor

You got it. :-)

return Object.getOwnPropertyNames(clsOrFunction.prototype).length > 0 || hasSymbol;
}
}

Expand Down

0 comments on commit 72c7ca0

Please sign in to comment.