Message from JavaScript discussions

May 2019

— 😐

— 

const isObject = o =>
o !== null &&
o !== undefined &&
typeof o === 'object';

const find = (f, obj) =>
Array.isArray(obj)
? find(f, obj.find(x => find(f, x)))
: isObject(obj)
? find(f, Object.values(obj))
: f(obj)
? obj
: undefined;

— Something like this I guess

— find(
x => x === 'hello',
{ f: { o: { o: { b: 'hello' } } } })
// returns 'hello'

— Might be optimizable

— Yeah, could do with an accumulator, sec

— Not quite sure what you want your predicate to receive

— The beauty of ternary operator :)

— Howd you format the code like that in telegram

— Thank you

— I had a nice conversation with a Scala developer, this guy said that ramdajs is nice but has some types that don't fit so well. He said to consider FP-TS. what do you think.

Message permanent page

— Someone should point out my error please.
It works with if statement
But returns both values with ternary operator.

Message permanent page