src/index.js
function modularScale(power, ratio, bases) {
  const scale = []
  let step = 0

  while (Math.abs(step) <= Math.abs(power)) {
    for (let i = 0; i < bases.length; i++) {
      scale.push(bases[i] * Math.pow(ratio, step))
    }

    step += 1

    if (power < 0) {
      step -= 2
    }
  }

  return Array.from(new Set(scale))[Math.abs(step) - 1] // eslint-disable-line no-undef
}
function modularScale(power, ratio, bases) {
  const scale = []
  let step = 0

  while (Math.abs(step) <= Math.abs(power)) {
    for (let i = 0; i < bases.length; i++) {
      scale.push(bases[i] * Math.pow(ratio, step))
    }

    step += 1

    if (power < 0) {
      step -= 2
    }
  }

  return Array.from(new Set(scale))[Math.abs(step) - 1] // eslint-disable-line no-undef
}
function modularScale ( power , ratio , bases ) { const scale = [ ] let step = 0 while ( Math . abs ( step ) <= Math . abs ( power ) ) { for ( let i = 0 ; i < bases . length ; i ++ ) { scale . push ( bases [ i ] * Math . pow ( ratio , step ) ) } step += 1 if ( power < 0 ) { step -= 2 } } return Array . from ( new Set ( scale ) ) [ Math . abs ( step ) - 1 ] // eslint-disable-line no-undef }
Calculate a modular scale value.

@param {number} power The power of the modular scale value.
@param {number} ratio The modular scale ratio.
@param {Array} bases One or more modular scale bases.
@returns {number}
Calculate a modular scale value .