function assign (obj, keyPath, value) {
  const lastKeyIndex = keyPath.length - 1

  for (let i = 0; i < lastKeyIndex; ++i) {
    const key = keyPath[i]
    if (!(key in obj)) obj[key] = {}
    obj = obj[key]
  }

  obj[keyPath[lastKeyIndex]] = value
}
function assign (obj, keyPath, value) {
  const lastKeyIndex = keyPath.length - 1

  for (let i = 0; i < lastKeyIndex; ++i) {
    const key = keyPath[i]
    if (!(key in obj)) obj[key] = {}
    obj = obj[key]
  }

  obj[keyPath[lastKeyIndex]] = value
}
function assign ( obj , keyPath , value ) { const lastKeyIndex = keyPath . length - 1 for ( let i = 0 ; i < lastKeyIndex ; ++ i ) { const key = keyPath [ i ] if ( ! ( key in obj ) ) obj [ key ] = { } obj = obj [ key ] } obj [ keyPath [ lastKeyIndex ] ] = value }
assigns values to an object, creating keys in
`keyPath` if they don't exist yet.
@param {object} obj - The object to assign values to
@param {array} keyPath - The path to assign in object [a,b] => obj.a.b
@param {any} value - The value to assign to the object
assigns values to an object creating keys in keyPath if they don t exist yet .