您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

31 行
723 B

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