UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

18 lines (17 loc) 616 B
import { flip, prepend, apply, last, juxt, compose, identity, useWith } from 'ramda'; import mapKeysAndValues from './mapKeysAndValues'; var wrapMapping = /*#__PURE__*/compose(juxt, /*#__PURE__*/flip(prepend)([last]), apply); /** * Map object keys. Mapping functions have both key and value as arguments. * * @func * @category Object * * @example * * R_.mapKeysWithValue((key, value) => value)({ foo: "bar" }) // { bar: "bar" } * * @sig ((String, a) -> b) -> Object -> Object */ var mapKeysWithValue = /*#__PURE__*/useWith(mapKeysAndValues, [wrapMapping, identity]); export default mapKeysWithValue;