source: node_modules/ramda/es/objOf.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 683 bytes
Line 
1import _curry2 from "./internal/_curry2.js";
2/**
3 * Creates an object containing a single key:value pair.
4 *
5 * @func
6 * @memberOf R
7 * @since v0.18.0
8 * @category Object
9 * @sig String -> a -> {String:a}
10 * @param {String} key
11 * @param {*} val
12 * @return {Object}
13 * @see R.pair
14 * @example
15 *
16 * const matchPhrases = R.compose(
17 * R.objOf('must'),
18 * R.map(R.objOf('match_phrase'))
19 * );
20 * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}
21 */
22
23var objOf =
24/*#__PURE__*/
25_curry2(function objOf(key, val) {
26 var obj = {};
27 obj[key] = val;
28 return obj;
29});
30
31export default objOf;
Note: See TracBrowser for help on using the repository browser.