Skip to content

add constructorName#3

Open
peterdenev wants to merge 8 commits intoIcarusSO:masterfrom
peterdenev:master
Open

add constructorName#3
peterdenev wants to merge 8 commits intoIcarusSO:masterfrom
peterdenev:master

Conversation

@peterdenev
Copy link
Contributor

If a constructor have a name:

var Person=Class({
 init:function Person(){
 }
})

Class name can be get:

Person.constructorName
//or
var p = new Person();
p.class.constructorName

P.S. not the best way but works.
N.B! It gets the "init", "_init", "$init" methods, but didn't look up for inherit data

@peterdenev
Copy link
Contributor Author

As the commits say:

  • define as UMD module (for ComminJS/RequireJs/normal global)
  • when using some sort of module loader (AMD) getting caller gets in infinite loop, so I set the max depth=20 (for now)
  • when creating Class property now can be set null or undefined
  • each class nas a collection of all interfaces that implements (inherited too)
  • instanceOf now check for Interfaces too

(Check out my repo for TypeValidation that can be used with ZNOW too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant