UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

35 lines (28 loc) 1.19 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ramda = require("ramda"); var _splitByDot = _interopRequireDefault(require("./splitByDot")); var _argumentsToList = _interopRequireDefault(require("./argumentsToList")); var _overHead = _interopRequireDefault(require("./overHead")); /** * Makes a shallow clone of an object, omitting the property at the given dot path. * Note that this copies and flattens * prototype properties onto the new object as well. All non-primitive properties are copied by reference. * * @func * @category Object * * @param {String} path The dot path to the value to omit * @param {Object} obj The object to clone * @return {Object} A new object without the property at path * @example * * R_.dissocDotPath('a.b.c', {a: {b: {c: 42}}}); //=> {a: {b: {}}} */ var dissocDotPath = (0, _ramda.curryN)(2, (0, _ramda.compose)((0, _ramda.apply)(_ramda.dissocPath), (0, _overHead.default)(_splitByDot.default), _argumentsToList.default)); var _default = dissocDotPath; exports.default = _default;