These are chat archives for ramda/ramda

13th
Jun 2018
mb
@crashspringfield
Jun 13 2018 12:19
I have a question about the addIndex documentation and I figured I'd ask it here before opening an issue. It seems like the definition is missing an opening parenthesis ((a … → b) … → [a] → *) → (a …, Int, [a] → b) … → [a] → *)
Daniel Rodríguez Rivero
@danielo515
Jun 13 2018 14:04
Hello guys
Are any of you using any babel plugin for making FP easier ?
Like this one for example ? https://github.com/citycide/param.macro
allexysleeps
@allexysleeps
Jun 13 2018 15:21
Hi guys. Does addIndex works with splitWhen??
const splitItems = R.addIndex(R.splitWhen)((_, index) => {
    console.log(_, index)
    return index % 2 === 0
  })
here i get only 3 iteration over 7 items list
and all 3 times index === 0
can't quite get what's wrong
Mike Lambert
@lax4mike
Jun 13 2018 16:54
@allexysleeps 0 % 2 is 0
R.splitWhen only splits once
Emilio Srougo
@Emilios1995
Jun 13 2018 19:27
Hi folks! how would you implement omitBy?
Mike Lambert
@lax4mike
Jun 13 2018 19:29
i guess it would be kind of like reject, but for an object
the predicate could be passed the key and the value
maybe like this:
const person = {
  name: "mike",
  age: 33
}

const omitBy = R.curry(
  (predicate, object) => R.compose(
    R.fromPairs,
    R.reject(R.apply(predicate)),
    R.toPairs
  )(object)
)

omitBy((key, value) => R.type(value) === "Number", person) // { name: "mike" }
Emilio Srougo
@Emilios1995
Jun 13 2018 19:42
Yeah, that looks good!
Yosbel Marín
@yosbelms
Jun 13 2018 19:46
Hindley-Milner to TS ramda/ramda#2561
Brad Compton (he/him)
@Bradcomp
Jun 13 2018 20:29
:scream:
Mike Lambert
@lax4mike
Jun 13 2018 20:52
i would use typescript if it understood Hindley-Milner