Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. DOT = function(obj,prop){
  2. if(obj.hasOwnProperty(prop)){
  3. return obj[prop];
  4. }else if(obj.__proto__){
  5. return DOT(obj.__proto__,prop)
  6. }
  7. }
  8.  
  9. DOTCALL = function(obj,props,args){
  10. var fn = DOT(obj,props);
  11. if(fn){
  12. return fn.apply(obj,args);
  13. }
  14. }
  15. NEW = function(constructor,args){
  16. var subject = {};
  17. subject.__proto__ = constructor.prototype;
  18. constructor.apply(subject,args);
  19. return subject;
  20. }
  21.  
  22. INSTANCEOF = function(obj,constructor){
  23. if(obj.__proto__ === constructor.prototype){
  24. return true;
  25. }else if(obj.__proto__){
  26. return INSTANCEOF(obj.__proto__,constructor);
  27. }else{
  28. return false;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement