UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

16 lines (15 loc) 583 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dissocIn = void 0; const main_1 = require("./main"); function dissocIn(path, dict) { if (arguments.length === 1) { return (theDict) => dissocIn(path, theDict); } const thePath = (0, main_1.getValue)(path); const pathPrefix = thePath.slice(0, thePath.length - 1); const prop = thePath[thePath.length - 1]; const theDict = (0, main_1.getValueOr)({}, dict); return (0, main_1.updateIn)(pathPrefix, (0, main_1.dissoc)(prop), theDict); } exports.dissocIn = dissocIn;