UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

31 lines (30 loc) 633 B
import { mapObjIndexed, nthArg } from 'ramda'; /** * Copies keys of object to appropriate values. * * @func * @category Object * * * @param {Object} Object where should be keys copied as values. * * @return {Object} * * @example * * const actionTypes = R_.keyMirror({ * ITEM_REQUEST: null, * ITEM_SUCCESS: null, * ITEM_ERROR: null, * }); * * const action = { type: actionTypes.ITEM_REQUEST }; * * action.type === actionTypes.ITEM_REQUEST // true * * * @sig Object -> Object * */ var keyMirror = /*#__PURE__*/mapObjIndexed( /*#__PURE__*/nthArg(1)); export default keyMirror;