main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
683 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _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 |
|
---|
| 23 | var objOf =
|
---|
| 24 | /*#__PURE__*/
|
---|
| 25 | _curry2(function objOf(key, val) {
|
---|
| 26 | var obj = {};
|
---|
| 27 | obj[key] = val;
|
---|
| 28 | return obj;
|
---|
| 29 | });
|
---|
| 30 |
|
---|
| 31 | export default objOf; |
---|
Note:
See
TracBrowser
for help on using the repository browser.