nl_tokens: reference to the unbound value of this
pl_tokens: function base ( args , ctor ) { var plain = false ; // class instance constructor function clas ( ) { // we can't simply use a plain new clas() here // since we might get called unbound from a child class // or as a constructor // therefore we must use the correct 'this' in that case if ( this !== global ) { plain ? ( plain = false ) : ctor . apply ( this , arguments ) ; return this ; } else { // Case of missing new keyword, a bit hackish but still // better than adding another prototype layer return ( plain = true ) && clas . apply ( new clas ( ) , arguments ) ; } } // closures copies of the base properties var properties = { } ; // constructor for sub classes e.g. Foo.init(barInstance, ...); clas . init = bind ( ctor ) ; // extend method of this class, needed to get access to the 'properties' // object of other classes clas . extend = function ( obj ) { if ( is ( 'Function' , obj ) ) { // Extend the class that wants to inherit if ( obj . hasOwnProperty ( 'extend' ) ) { return obj . extend ( properties ) ; } } else { for ( var i in obj ) { if ( obj . hasOwnProperty ( i ) ) { extend ( clas , <mask> , obj , i ) ; } } } return clas ; } ; // Extend and inherit var i = is ( 'Function' , ctor ) && ctor . hasOwnProperty ( 'init' ) ? 0 : 1 ; for ( var l = args . length ; i < l ; i ++ ) { if ( is ( 'Object' , args [ i ] ) ) { clas . extend ( args [ i ] ) ; } else { // We're inheriting, so we need access to the other class's // 'properties' object, therefore, call that class which then // calls the extend method of this class and passes its // 'properties' object args [ i ] . extend ( clas ) ; } } return clas ; }