mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 14:43:33 +03:00
33 lines
737 B
TypeScript
33 lines
737 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/objOf.js
|
|
|
|
|
|
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 = _curry2(function objOf(key, val) {
|
|
var obj = {};
|
|
obj[key] = val;
|
|
return obj;
|
|
});
|
|
export default objOf;
|