UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

16 lines (15 loc) 455 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pick = void 0; const main_1 = require("./main"); function pick(props, dict) { if (arguments.length === 1) { return (_dict) => pick(props, _dict); } const dd = (0, main_1.getValueOr)({}, dict); return (0, main_1.getValueOr)([], props).reduce((accum, key) => { accum[key] = dd[key]; return accum; }, {}); } exports.pick = pick;