object/create.js

  1. import { set } from 'core/set'
  2. /**
  3. * create a new Object with the value set at <code>path</code>
  4. * @function
  5. * @memberof object
  6. * @param {Array|string} path The path of the property to set.
  7. * @param {*} value The value to set
  8. * @return {Object} Returns the new object createialized.
  9. * @example create({}, 'nested.prop', 1) // => { nested: { prop: 1 } }
  10. * @since 2.0.0
  11. */
  12. const create = (path, value) => set({}, path, value)
  13. export { create }