test-action-debian-package/node_modules/ramda/es/objOf.js

31 lines
683 B
JavaScript
Raw Normal View History

2020-03-26 14:37:35 +00:00
import _curry2 from "./internal/_curry2.js";
/**
* Creates an object containing a single key:value pair.
*
* @func
* @memberOf R
* @since v0.18.0
* @category Object
* @sig String -> a -> {String:a}
* @param {String} key
* @param {*} val
* @return {Object}
* @see R.pair
* @example
*
* const matchPhrases = R.compose(
* R.objOf('must'),
* R.map(R.objOf('match_phrase'))
* );
* matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}
*/
var objOf =
/*#__PURE__*/
_curry2(function objOf(key, val) {
var obj = {};
obj[key] = val;
return obj;
});
export default objOf;