Robert Brax Robert Brax - 1 year ago 144
Javascript Question

Parametrize a function

Is there any way to parametrize whereEq, so i can remove 'complete: true' and pass this information when calling the function in console log example below ?

let incomplete = R.filter( R.whereEq( { complete: false } ) )

console.log( incomplete( data ))

Answer Source

R.wrap could be helpful here.

let incomplete = R.wrap(R.filter, function(filter, array, isComplete) {
  return filter( R.whereEq( { complete: isComplete }), array )

incomplete(data, false);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download