node-extend
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,21 +0,54 @@ | ||
function extend(A, B, as, isAargs) { | ||
var ___A___ = A, ___B___ = B; | ||
if (arguments.length < 2) throw new Error("arguments is error!"); | ||
var args = ""; | ||
if (arguments.length > 2) if (isAargs) { | ||
args += "var args = ["; | ||
for (var i = 0; i < as.length; i++) args += "arguments[" + as[i] + "]", i !== as.length - 1 && (args += ","); | ||
args += "];"; | ||
} else args = "var args = " + JSON.stringify(as) + ";"; | ||
var s = A.toString(), footer = "}", header = s.match(/^(function)(.)*{/gi), e = ""; | ||
args ? e += "___B___.apply(this,args);" : e += "___B___.apply(this);", e += "___A___.apply(this,arguments)"; | ||
var ss = header + e + footer, nn = eval("(" + ss + ")"), ap = A.prototype; | ||
util.inherits(nn, B); | ||
for (var k in A) nn[k] = A[k]; | ||
for (var k in ap) nn.prototype[k] = ap[k]; | ||
return nn; | ||
var util = require('util'); | ||
module.exports = extend; | ||
extend.EXTEND = 'EXTEND'; | ||
function extend(A,B,B_args){ | ||
var ___A___ = A; | ||
var ___B___ = B; | ||
if(arguments.length < 2){ | ||
throw new Error('arguments is error!'); | ||
} | ||
var args = ""; | ||
if(arguments.length > 2){ | ||
if(!B_args){} | ||
else if(B_args === extend.EXTEND){ | ||
args += 'var args = arguments'; | ||
}else if(B_args.length >= 0){ | ||
args += 'var args = ['; | ||
for(var i=0 ; i<as.length ; i++){ | ||
args += 'arguments['+as[i]+']'; | ||
if(i!==as.length-1) args += ','; | ||
} | ||
args += '];' | ||
} | ||
} | ||
var s = A.toString(); | ||
var footer = '}' | ||
var header = s.match(/^(function)(.)*{/gi); | ||
var e = ''; | ||
if(args){e += '___B___.apply(this,args);'}else{e += '___B___.apply(this);';} | ||
e+='___A___.apply(this,arguments)'; | ||
var ss = header+e+footer | ||
var nn = eval('('+ss+')'); | ||
var ap = A.prototype; | ||
util.inherits(nn,B); | ||
for(var k in A){ | ||
nn[k] = A[k]; | ||
} | ||
for(var k in ap){ | ||
nn.prototype[k] = ap[k]; | ||
} | ||
return nn; | ||
} | ||
var util = require("util"); | ||
module.exports = extend; |
{ | ||
"name": "node-extend", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "extend for javascript", | ||
@@ -19,3 +19,3 @@ "main": "index.js", | ||
"author": "brighthas", | ||
"license": "BSD" | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
0
0
1
2033
4
41