All files objOf.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 351x                                                     1x 2x       2x    
import { purry } from './purry';
 
/**
 * Creates an object containing a single `key:value` pair.
 * @param value the object value
 * @param key the property name
 * @signature
 *    R.objOf(value, key)
 * @example
 *    R.objOf(10, 'a') // => { a: 10 }
 * @category Object
 */
export function objOf<T, K extends string>(value: T, key: K): { [x in K]: T };
 
/**
 * Creates an object containing a single `key:value` pair.
 * @param key the property name
 * @signature
 *    R.objOf(key)(value)
 * @example
 *    R.pipe(10, R.objOf('a')) // => { a: 10 }
 * @category Object
 */
export function objOf<T, K extends string>(
  key: K
): (value: T) => { [x in K]: T };
 
export function objOf() {
  return purry(_objOf, arguments);
}
 
function _objOf(value: any, key: string) {
  return { [key]: value };
}