ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
39 lines (36 loc) • 749 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("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 = (0, _ramda.mapObjIndexed)((0, _ramda.nthArg)(1));
var _default = keyMirror;
exports.default = _default;