UNPKG

740 BJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4/**
5 * Returns a new object that does not contain a `prop` property.
6 *
7 * @func
8 * @memberOf R
9 * @since v0.10.0
10 * @category Object
11 * @sig String -> {k: v} -> {k: v}
12 * @param {String} prop The name of the property to dissociate
13 * @param {Object} obj The object to clone
14 * @return {Object} A new object equivalent to the original but without the specified property
15 * @see R.assoc, R.omit
16 * @example
17 *
18 * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}
19 */
20
21
22var dissoc =
23/*#__PURE__*/
24_curry2(function dissoc(prop, obj) {
25 var result = {};
26
27 for (var p in obj) {
28 result[p] = obj[p];
29 }
30
31 delete result[prop];
32 return result;
33});
34
35module.exports = dissoc;
\No newline at end of file