dist/axis3d.js
/**
 * Ensures an array of rgba floats contains exactly 4 numbers. If an alpha
 * channel value is missing, then it is assumed to be '1'.
 * ensureRGBA(color: Array<...Number>) -> Array<Number, Number, Number, Number>>
 */
Ensures an array of rgba floats contains exactly 4 numbers. If an alpha
channel value is missing, then it is assumed to be '1'.
Ensures an array of rgba floats contains exactly 4 numbers . If an alpha channel value is missing then it is assumed to be ' 1 ' .
function ensureRGBA(color) {
  color = [].concat(_toConsumableArray(color || []));
  for (var i = 0; i < 3; ++i) {
    if ('number' != typeof color[i]) {
      color[i] = 0;
    } else {
      color[i] = (0, _clamp2.default)(color[i], 0, 1);
    }
  }
  if ('number' != typeof color[3]) {
    color[3] = 1;
  } else {
    color[3] = (0, _clamp2.default)(color[3], 0, 1);
  }
  return [].concat(_toConsumableArray(color)).slice(0, 4);
}
function ensureRGBA ( color ) { color = [ ] . concat ( _toConsumableArray ( color || [ ] ) ) ; for ( var i = 0 ; i < 3 ; ++ i ) { if ( 'number' != typeof color [ i ] ) { color [ i ] = 0 ; } else { color [ i ] = ( 0 , _clamp2 . default ) ( color [ i ] , 0 , 1 ) ; } } if ( 'number' != typeof color [ 3 ] ) { color [ 3 ] = 1 ; } else { color [ 3 ] = ( 0 , _clamp2 . default ) ( color [ 3 ] , 0 , 1 ) ; } return [ ] . concat ( _toConsumableArray ( color ) ) . slice ( 0 , 4 ) ; }
Ensures an array of rgba floats contains exactly 4 numbers.
Ensures an array of rgba floats contains exactly 4 numbers .