OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-store / store / lib / function.js

32 lines · javascript ref:
export const curryRight = (t, e) => {
  const n = e || t.length,
    o = (...e) => (e.length >= n ? t(...e) : (...t) => o(...t.concat(e)))
  return o
}
export function combineReducers(t) {
  const e = Object.keys(t).filter((e) => "function" == typeof t[e])
  return function (n, o) {
    let c = !1
    const r = {}
    for (let u = 0; u < e.length; u += 1) {
      const l = e[u],
        s = t[l],
        f = n[l],
        i = s(f, o)
      ;((r[l] = i), (c = c || i !== f))
    }
    return c ? { ...n, ...r } : n
  }
}
export function compose(...t) {
  return 0 === t.length
    ? (t) => t
    : 1 === t.length
      ? t[0]
      : t.reduce(
          (t, e) =>
            (...n) =>
              t(e(...n)),
        )
}