Added check for bare numbers in bound, if bare numbers are provided they will now be converted to single element arrays
This commit is contained in:
parent
81e26a625a
commit
a793129169
@ -163,9 +163,10 @@ function deg2vec (deg) { //abstraction, really just for sanity
|
|||||||
|
|
||||||
class bound {
|
class bound {
|
||||||
constructor (min=[-Infinity],max=[Infinity]) {
|
constructor (min=[-Infinity],max=[Infinity]) {
|
||||||
|
// Failsafe if bare numbers are provided instead of an array
|
||||||
// Insure both inputs are arrays with valid numbers
|
// Insure both inputs are arrays with valid numbers
|
||||||
min = Array.isArray(min) ? min.map(value => !isNaN(value) ? value : -Infinity) : [-Infinity];
|
min = Array.isArray(min) ? min.map(value => !isNaN(value) ? value : -Infinity) : ( !isNaN(min) ? [min] : [-Infinity] );
|
||||||
max = Array.isArray(max) ? max.map(value => !isNaN(value) ? value : -Infinity) : [Infinity];
|
max = Array.isArray(max) ? max.map(value => !isNaN(value) ? value : -Infinity) : ( !isNaN(max) ? [max] : [Infinity] );
|
||||||
// Insure both arrays are equal in size
|
// Insure both arrays are equal in size
|
||||||
while( min.length != max.length ) {
|
while( min.length != max.length ) {
|
||||||
if (min.length > max.length) { max.push(Infinity);
|
if (min.length > max.length) { max.push(Infinity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user