| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 13x 3x 7x | /**
* Returns a function for handling key resolver pairs
* @param {Object} input object
*/
export default function resolveKey(
input,
context = {},
{ isSync = false } = {}
) {
return isSync === true
? ({ key, fn }) => ({ key, value: fn(input, context) })
: ({ key, fn }) =>
Promise.resolve(fn(input, context)).then(value => ({ key, value }));
}
|