These are chat archives for ramda/ramda

27th
Nov 2017
Matt McKellar-Spence
@MattMS
Nov 27 2017 08:05
@xgrommx re: eweda, check out "The Name" section on http://ramdajs.com/ ;)
Lasse Löytynoja
@lloytynoja
Nov 27 2017 13:01
Hi all! I'm having trouble with the condition argument of ifElse in this : https://goo.gl/5fxRQ2
When replaced with R.T or R.F, it works. Shouldn't R.contains return similar value so it could be used here as well?
ants
@antoaravinth
Nov 27 2017 13:48
Can lenses be used to flatten a deep json structure to a flatten one?
Philipp Wille
@Yord
Nov 27 2017 15:40
@antoaravinth Well, generally speaking, Lenses provide immutable "getters" and "setters" for (nested) objects. You could of course use setters to flatten an object. But this is not what lenses as such are made for. I would instead use chain and similar functions to transform the structure and write lenses for the result.
Scott Sauyet
@CrossEye
Nov 27 2017 15:50
@lloytynoja: The first argument to ifElse is a predicate function, not a boolean value. You can wrap your contains in always, or return it from a function, () => contains(/* ... */). https://goo.gl/1rpysm
Scott Sauyet
@CrossEye
Nov 27 2017 15:59
@msg2saddam_twitter: I think we need more information.

also, to format your code wrap it in triple backquote lines:

like
this

Before the first line and after the last one is a line containing just "```".

Md Saddam
@msg2saddam_twitter
Nov 27 2017 16:01
[
    {
        "dates": [
            1503945000000,
            1504031400000,
            1504117800000,
            1504204200000,
            1504377000000,
            1504463400000,
            1504549800000
        ],
        "from": "BRve0x1bFfhPflqsMH1GgiDRoku1",
        "message": "Testing",
        "subject": "Saddam",
        "timestamp": 1503858970291
    },
    {
        "dates": [
            1503858600000
        ],
        "from": "BRve0x1bFfhPflqsMH1GgiDRoku1",
        "message": "For P R",
        "subject": "OOO",
        "timestamp": 1503901377773
    }
this.db.list(${tableNames.LeaveMessage}/${channelId},
ref => ref.orderByChild('dates').equalTo('1503945000000')
)
@CrossEye I need solution for firebase.
Scott Sauyet
@CrossEye
Nov 27 2017 16:14
Although I've done some firebase, I don't know what you need. If I were to write this in Ramda, I would do something like:
const filterByDate = date => msgs => filter(msg => contains(date, msg.dates), msgs)
filterByDate(1504031400000)(msgs) //=> <your first object>
filterByDate(1503858600000)(msgs) //=> <your second object>
Md Saddam
@msg2saddam_twitter
Nov 27 2017 16:16
Yes this currect but i have to filter from firebase db
If you want i can give u my request URL (with remove auth then u can try)
Scott Sauyet
@CrossEye
Nov 27 2017 16:18
I'm afraid this is the wrong place to ask that. Is there a firebase chat?
Md Saddam
@msg2saddam_twitter
Nov 27 2017 16:18
yes :)
Scott Sauyet
@CrossEye
Nov 27 2017 16:18
Well that sounds like the right place. Good luck!
Lasse Löytynoja
@lloytynoja
Nov 27 2017 17:48
@CrossEye Thanks! That did it. I've just begun learning ramda / FP in general and if you or somebody else got any feedback how that code in repl could be improved, I'd appreciate it!