1!function (name, definition) { 2 if (typeof define == 'function') define(definition) 3 else if (typeof module != 'undefined') module.exports = definition() 4 else this[name] = definition() 5}('klass', function () { 6 var context = this 7 , old = context.klass 8 , f = 'function' 9 , fnTest = /xyz/.test(function () {xyz}) ? /\bsupr\b/ : /.*/ 10 , proto = 'prototype' 11 12 function klass(o) { 13 return extend.call(isFn(o) ? o : function () {}, o, 1) 14 } 15 16 function isFn(o) { 17 return typeof o === f 18 } 19 20 function wrap(k, fn, supr) { 21 return function () { 22 var tmp = this.supr 23 this.supr = supr[proto][k] 24 var ret = fn.apply(this, arguments) 25 this.supr = tmp 26 return ret 27 } 28 } 29 30 function process(what, o, supr) { 31 for (var k in o) { 32 if (o.hasOwnProperty(k)) { 33 what[k] = isFn(o[k]) 34 && isFn(supr[proto][k]) 35 && fnTest.test(o[k]) 36 ? wrap(k, o[k], supr) : o[k] 37 } 38 } 39 } 40 41 function extend(o, fromSub) { 42 // must redefine noop each time so it doesn't inherit from previous arbitrary classes 43 function noop() {} 44 noop[proto] = this[proto] 45 var supr = this 46 , prototype = new noop() 47 , isFunction = isFn(o) 48 , _constructor = isFunction ? o : this 49 , _methods = isFunction ? {} : o 50 function fn() { 51 if (this.initialize) this.initialize.apply(this, arguments) 52 else { 53 fromSub || isFunction && supr.apply(this, arguments) 54 _constructor.apply(this, arguments) 55 } 56 } 57 58 fn.methods = function (o) { 59 process(prototype, o, supr) 60 fn[proto] = prototype 61 return this 62 } 63 64 fn.methods.call(fn, _methods).prototype.constructor = fn 65 66 fn.extend = arguments.callee 67 fn[proto].implement = fn.statics = function (o, optFn) { 68 o = typeof o == 'string' ? (function () { 69 var obj = {} 70 obj[o] = optFn 71 return obj 72 }()) : o 73 process(this, o, supr) 74 return this 75 } 76 77 return fn 78 } 79 80 klass.noConflict = function () { 81 context.klass = old 82 return this 83 } 84 context.klass = klass 85 86 return klass 87});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.