Skip to content

Commit

Permalink
CURRY ALL THE THINGS! 馃崨馃崨馃崨
Browse files Browse the repository at this point in the history
  • Loading branch information
kutyel committed Dec 14, 2017
1 parent a00ba6c commit bbc51a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ export const chain = curry((f, m) => m.map(f).join())

export const concat = curry((x, y) => x.concat(y))

export const filter = f => xs => xs.filter(f)
export const filter = curry((f, xs) => xs.filter(f))

export const flip = f => curry((x, y, ...args) => f(y, x, ...args))

export const head = xs => xs[0]

export const identity = x => x

export const join = char => x => x.join(char)
export const join = curry((char, x) => x.join(char))

export const last = xs => xs[xs.length - 1]

export const map = f => xs => xs.map(f)
export const map = curry((f, xs) => xs.map(f))

export const prop = prop => obj => obj[prop]
export const prop = curry((prop, obj) => obj[prop])

export const reduce = curry((reducer, init, xs) => xs.reduce(reducer, init))

export const replace = (regex, char) => str => str.replace(regex, char)
export const replace = curry((regex, char, str) => str.replace(regex, char))

export const sortBy = f => xs => xs.sort((x, y) => f(x) > f(y))
export const sortBy = curry((f, xs) => xs.sort((x, y) => f(x) > f(y)))

export const split = char => x => x.split(char)
export const split = curry((char, x) => x.split(char))

export const toLower = str => str.toLowerCase()

Expand Down

0 comments on commit bbc51a0

Please sign in to comment.