src/utils.js
/**
 * Returns a normalized scale vector with optional defaults applied.
 * normalizeScaleVector(scale: Array|Number,
 *                      [defaultScale: Array|Number]) -> Array
 */
Returns a normalized scale vector with optional defaults applied.
Returns a normalized scale vector with optional defaults applied .
function normalizeScaleVector(scale, defaultScale = [1, 1, 1]) {
  if ('number' == typeof defaultScale) {
    defaultScale = normalizeScaleVector(defaultScale, [1, 1, 1])
  }
  if ('number' == typeof scale) {
    return fill(3, scale)
  } else if (Array.isArray(scale)) {
    return Object.assign(scale, Object.assign([], defaultScale, scale)).slice(0, 3)
  } else {
    return defaultScale
  }
}
function normalizeScaleVector ( scale , defaultScale = [ 1 , 1 , 1 ] ) { if ( 'number' == typeof defaultScale ) { defaultScale = normalizeScaleVector ( defaultScale , [ 1 , 1 , 1 ] ) } if ( 'number' == typeof scale ) { return fill ( 3 , scale ) } else if ( Array . isArray ( scale ) ) { return Object . assign ( scale , Object . assign ( [ ] , defaultScale , scale ) ) . slice ( 0 , 3 ) } else { return defaultScale } }
Returns a normalized scale vector with optional defaults applied.
Returns a normalized scale vector with optional defaults applied .