/reduceWithValueKey

Primary LanguageJavaScriptOtherNOASSERTION

@unction/reduceWithValueKey

Tests Stability Dependencies

ReducerFunctionType<A, B | D, C> => D => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string => E

Reduces over a functor, providing the reducer with the value and key.

reduceWithValueKey(
  (accumulation) => (current) => (key) => `${accumulation}/${current}:${key}`
)(
  "~"
)(
  ["Users", "krainboltgreene", "Code"]
)

Which will return:

"~/Users:0/krainboltgreene:1/Code:2"