Comparing version 1.0.1 to 1.0.2
@@ -28,12 +28,12 @@ "use strict" | ||
this.stride = c;\ | ||
this.offset = d;\ | ||
}\ | ||
ZeroArray.prototype.size=function(){return 0}\ | ||
ZeroArray.prototype.order=function(){return []}\ | ||
this.offset = d\ | ||
};\ | ||
ZeroArray.prototype.size=0;\ | ||
ZeroArray.prototype.order=[];\ | ||
ZeroArray.prototype.get=function() {\ | ||
return Number.NaN\ | ||
}\ | ||
};\ | ||
ZeroArray.prototype.set=function(v) {\ | ||
return Number.NaN\ | ||
}\ | ||
};\ | ||
ZeroArray.prototype.lo=\ | ||
@@ -50,3 +50,6 @@ ZeroArray.prototype.hi=\ | ||
if(dimension === 0) { | ||
var compiledProc = new Function(ZeroArray+"ZeroArray.prototype.dtype='"+dtype+"'") | ||
var compiledProc = new Function([ | ||
ZeroArray, | ||
"ZeroArray.prototype.dtype='"+dtype+"'", | ||
"return ZeroArray"].join("\n")) | ||
return compiledProc() | ||
@@ -77,36 +80,43 @@ } | ||
//view.size(): | ||
//view.size: | ||
code.push(["Object.defineProperty(proto,'size',{get:function ",className,"_size(){var s=this.shape"].join("")) | ||
code.push(["return ", indices.map(function(i) { | ||
code.push("return " + indices.map(function(i) { | ||
return ["s[",i,"]"].join("") | ||
}).join("*")].join("")) | ||
}).join("*")) | ||
code.push("}})") | ||
//view.order(): | ||
code.push(["Object.defineProperty(proto,'order',{get:function ",className,"_order(){"].join("")) | ||
//view.order: | ||
if(dimension === 1) { | ||
code.push("return [0]") | ||
} else if(dimension === 2) { | ||
code.push("return (this.stride[0]>this.stride[1])?[1,0]:[0,1]") | ||
} else if(dimension === 3) { | ||
code.push("var s=this.stride") | ||
code.push("if(s[0] > s[1]){") | ||
code.push("if(s[1]>s[2]){") | ||
code.push("return [2,1,0]") | ||
code.push("}else if(s[0]>s[2]){") | ||
code.push("return [1,2,0]") | ||
code.push("}else{") | ||
code.push("return [1,0,2]") | ||
code.push("proto.order=[0]") | ||
} else { | ||
code.push("Object.defineProperty(proto,'order',{get:") | ||
if(dimension < 4) { | ||
code.push(["function ",className,"_order(){"].join("")) | ||
if(dimension === 2) { | ||
code.push("return (this.stride[0]>this.stride[1])?[1,0]:[0,1]") | ||
} else if(dimension === 3) { | ||
code.push( | ||
"var s=this.stride;\ | ||
if(s[0] > s[1]){\ | ||
if(s[1]>s[2]){\ | ||
return [2,1,0];\ | ||
}else if(s[0]>s[2]){\ | ||
return [1,2,0];\ | ||
}else{\ | ||
return [1,0,2];\ | ||
}\ | ||
}else if(s[0]>s[2]){\ | ||
return [2,0,1];\ | ||
}else if(s[2]>s[1]){\ | ||
return [0,1,2];\ | ||
}else{\ | ||
return [0,2,1];\ | ||
}") | ||
} | ||
code.push("}") | ||
code.push("}else if(s[0]>s[2]){") | ||
code.push("return [2,0,1]") | ||
code.push("}else if(s[2]>s[1]){") | ||
code.push("return [0,1,2]") | ||
code.push("}else{") | ||
code.push("return [0,2,1]") | ||
code.push("}") | ||
} else { | ||
code.push("return ORDER(this.stride)") | ||
} else { | ||
code.push("ORDER") | ||
} | ||
code.push("})") | ||
} | ||
code.push("}})") | ||
@@ -113,0 +123,0 @@ //view.set(i0, ..., v): |
{ | ||
"name": "ndarray", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Multidimensional Arrays", | ||
@@ -14,3 +14,6 @@ "main": "ndarray.js", | ||
"tap": "~0.4.0", | ||
"tape": "~1.0.4" | ||
"tape": "~1.0.4", | ||
"permutation-rank": "0.0.0", | ||
"dup": "0.0.0", | ||
"invert-permutation": "0.0.0" | ||
}, | ||
@@ -17,0 +20,0 @@ "scripts": { |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
234
17967
5