dissoc.js 687 B

1234567891011121314151617181920212223242526
  1. import _curry2 from "./internal/_curry2.js";
  2. import dissocPath from "./dissocPath.js";
  3. /**
  4. * Returns a new object that does not contain a `prop` property.
  5. *
  6. * @func
  7. * @memberOf R
  8. * @since v0.10.0
  9. * @category Object
  10. * @sig String -> {k: v} -> {k: v}
  11. * @param {String} prop The name of the property to dissociate
  12. * @param {Object} obj The object to clone
  13. * @return {Object} A new object equivalent to the original but without the specified property
  14. * @see R.assoc, R.omit
  15. * @example
  16. *
  17. * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}
  18. */
  19. var dissoc =
  20. /*#__PURE__*/
  21. _curry2(function dissoc(prop, obj) {
  22. return dissocPath([prop], obj);
  23. });
  24. export default dissoc;