mirror of
https://forge.murkfall.net/bluesaxman/blue.js.git
synced 2026-03-13 09:34:20 -06:00
slight syntax corrections
This commit is contained in:
@@ -35,13 +35,13 @@ class vector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add(vec=new vector([...this.d.map(d => 0)]) {
|
add(vec=new vector([...this.d.map(d => 0)])) {
|
||||||
vec = vec instanceof vector ? vec : new vector([0]);
|
vec = vec instanceof vector ? vec : new vector([0]);
|
||||||
var longest = vec.d.length > this.d.length ? vec.d : this.d;
|
var longest = vec.d.length > this.d.length ? vec.d : this.d;
|
||||||
var shortest = vec.d.length < this.d.length ? vec.d : this.d;
|
var shortest = vec.d.length < this.d.length ? vec.d : this.d;
|
||||||
return new vector([...longest.map(function (value,index) {
|
return new vector([...longest.map(function (value,index) {
|
||||||
var small = shortest[index];
|
var small = shortest[index];
|
||||||
if !isNaN(small) { return value + small; } else { return value; }
|
if (!isNaN(small)) { return value + small; } else { return value; }
|
||||||
})]);
|
})]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class vector {
|
|||||||
var shortest = vec.d.length < this.d.length ? vec.d : this.d;
|
var shortest = vec.d.length < this.d.length ? vec.d : this.d;
|
||||||
return new vector([...longest.map(function (value,index) {
|
return new vector([...longest.map(function (value,index) {
|
||||||
var small = shortest[index];
|
var small = shortest[index];
|
||||||
if (!isNaN(small) { return value * small; } else { value; }
|
if (!isNaN(small)) { return value * small; } else { value; }
|
||||||
})]);
|
})]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user