Home Equivalent to Python self.__class__ in Node
Reply: 0

Equivalent to Python self.__class__ in Node

user695 Published in March 18, 2018, 1:51 am

I'm currently looking for a way to do the equivalent of Python's self.__class__ method in NodeJS. I'm trying to implement a compatibility layer for dict on NodeJs's Object, by implementing most methods of the dict class.

I need this to implement Python's dict.update method. One workaround, is to just call a function that has the same code as in the class method, then initialize the class there and run the .update() method if it is equivalent to Python's dict (typeof dict[key] == 'object' && dict[key] !== null)

Code: https://gist.github.com/wolfy1339/8e49b4a12a234bfe0bf1458665e68de0

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297175 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO