These are chat archives for ramda/ramda

10th
Jul 2018
catwen
@wenpengfei
Jul 10 2018 08:17
R.filter(R.or(R.propEq("Status", "submited"), R.propEq("Status", "canceled")), orders)
hello every...
// why it do not work????
R.filter(R.or(R.propEq("Status", "submited"), R.propEq("Status", "canceled")), orders)

// this works why???
R.filter(item => {
  return R.or(
    R.propEq("Status", "submited")(item),
    R.propEq("Status", "canceled")(item)
  );
}, orders)
I want filter status eq 'submited' or 'canceled'
In array "orders"
Adam Szaraniec
@mimol91
Jul 10 2018 09:16
@wenpengfei
1st snipped is this same as
R.filter(item =>
  R.or(
    R.propEq("Status", "submited"), 
    R.propEq("Status", "canceled")
  )(item)
  , orders
)
Adam Szaraniec
@mimol91
Jul 10 2018 09:34
Maybe you are looking for
R.filter(
  R.pathSatisfies((R.flip(R.contains)(["submited","canceled"])), ['Status'])
)(orders)
webduvet
@webduvet
Jul 10 2018 10:08
@wenpengfei what you are looking for is R.either
BasH
@bas080
Jul 10 2018 16:53
Could I use an iterator with functions like takeWhile?
Or should I use some other type of lazy sequence?
Seeing the source code it looks like that's not possible.
Rocky Madden
@rockymadden
Jul 10 2018 20:30
@bas080 Not that I am aware but you could use Most (https://github.com/cujojs/most/blob/master/docs/api.md) and do so in a functional way.
BasH
@bas080
Jul 10 2018 20:41
@rockymadden, It's not that big of a sequence I need. I'm using until instead. Thnx for referencing this cool library.
Rocky Madden
@rockymadden
Jul 10 2018 20:42
Gotcha and you bet!