src/function/matrix/subset.js
function _setObjectProperty (object, index, replacement) {
  if (index.size().length !== 1) {
    throw new DimensionError(index.size(), 1)
  }

  const key = index.dimension(0)
  if (typeof key !== 'string') {
    throw new TypeError('String expected as index to retrieve an object property')
  }

  // clone the object, and apply the property to the clone
  const updated = clone(object)
  setSafeProperty(updated, key, replacement)

  return updated
}
function _setObjectProperty (object, index, replacement) {
  if (index.size().length !== 1) {
    throw new DimensionError(index.size(), 1)
  }

  const key = index.dimension(0)
  if (typeof key !== 'string') {
    throw new TypeError('String expected as index to retrieve an object property')
  }

  // clone the object, and apply the property to the clone
  const updated = clone(object)
  setSafeProperty(updated, key, replacement)

  return updated
}
function _setObjectProperty ( object , index , replacement ) { if ( index . size ( ) . length !== 1 ) { throw new DimensionError ( index . size ( ) , 1 ) } const key = index . dimension ( 0 ) if ( typeof key !== 'string' ) { throw new TypeError ( 'String expected as index to retrieve an object property' ) } // clone the object, and apply the property to the clone const updated = clone ( object ) setSafeProperty ( updated , key , replacement ) return updated }
Set a property on an object
@param {Object} object
@param {Index} index
@param {*} replacement
@return {*} Returns the updated object
@private
Set a property on an object