These are chat archives for ramda/ramda

30th
Mar 2018
funfunction
@funfunction
Mar 30 2018 01:03
@GantMan pretty good. I also did it like this....
const c = R.compose(
  R.isEmpty,
  R.flatten,  // handles any number of array nestings
  R.values
);

const cb = e => c(e);
const f = R.reject(cb);
R.isEmpty(f(ary));
Pedr Browne
@Undistraction
Mar 30 2018 10:39
How do people deal with situations where you need to get a configuration value (one that is only known at runtime) into functions that are a long way from the point where the configuration is defined? I find myself using closure a lot - defining functions where I have a config obj in scope so either they have access to it via closure or so I can partially apply the part(s) of the config I want to those functions. Is there a better way?
Matthew Willhite
@miwillhite
Mar 30 2018 15:21
@Undistraction I believe you want a Reader
Brad Compton (he/him)
@Bradcomp
Mar 30 2018 16:43
Hi @BipinBhandari, welcome! You can always use something like reduce to do this, here I've used R.reduced to short circuit once an error is found: https://goo.gl/Q6TwQc
The down side is that you end up running the failing validation function twice
Though that's a minor concern, I know some people don't like it
Pedr Browne
@Undistraction
Mar 30 2018 17:01
@miwillhite Thanks. That is exactly what I want.
Bipin Bhandari
@BipinBhandari
Mar 30 2018 17:37
@Bradcomp Thanks a lot!
Anthony Palmer
@AnthonyP4312
Mar 30 2018 23:20

Hey there, if someone could help me debug this issue I'd appreciate it.

  const members = R.pipe(
    R.pathOr({}, ['channels', channelID, 'members']),
    R.keys,
    R.reject(R.equals('a key')),
  )(roomData)

Typescript is giving me a compile error on the R.reject line, saying I cant assign a string[] to a Dictionary<string>.

After looking at this for a while I realized I could do the same thing I wanted by swapping out reject for without but I'm curious as to whats keeping this from working.

Why wouldnt reject be able to operate on an array of strings?