Questions tagged [ramda.js]

Ramda is a functional utility library for Javascript, focusing on making it easy to build modular pipelines out of small, composable functions.

Ramda is a functional utility library for Javascript, focusing on making it easy to build modular pipelines out of small, composable functions.

Functions in Ramda are curried, meaning that if called with fewer than the required number of parameters, they will simply return new (curried) functions that require the remaining ones. Parameter order is different than the native order or the order in libraries such as Underscore or LoDash; those parameters expected to change the most (generally the data being operated on) are supplied last.

Useful Links

1196 questions
-1
votes
1 answer

Deeply inspect a javascript object for finding references

I am getting my ahead around a problem. I have a JS object which as following: { obj: { o1: { id: "o1", name: "o1", fields: { f1: { id: "o1:f1", type: { id: "o5" } }, …
Ste
  • 283
  • 1
  • 15
-1
votes
2 answers

Javascript, Ramda, Typescript- Rename key to an correct case

I have an object with keys in camelCase { "studentName": "ABC", "studentId": "12345", "age": 18, "submittedAt": "xxxxxx" } I want to convert object above into keys snake_case { "student_name": "ABC", "student_id": "12345", "age": 18, …
franco phong
  • 2,219
  • 3
  • 26
  • 43
-1
votes
2 answers

What is fully ramda.js equivalent of this code?

i need create function that updates item with certain id in list by merging payload object in ramda.js way export const updateItem = (items: T[], id: I, payload: Partial) => items.map( item => item.id === id ?…
RomanGodMode
  • 325
  • 3
  • 11
-1
votes
1 answer

filter json response property based on locale query parameter

I have a json response that i'm getting from an api and mongoDB as following: I'm passing query Param in the request which I also have access to it in nestjs app.service.ts query param ?locale can be either en, es, or de default one being en if no…
Exodus Reed
  • 177
  • 1
  • 10
-1
votes
1 answer

transform map with inner foreach to ramdajs

i'm pretty new to ramdajs, however I do understand the concepts of functional programming so a little help with this challenge will set me off forward. so I have two json responses related by a foreign Key relationship, carId in this case. where a…
Exodus Reed
  • 177
  • 1
  • 10
-1
votes
1 answer

Chunk array based on conditional logic using ramda

I have an array of sizes that I’d like to reduce + chunk based on custom logic using ramda: const sizes = [ { size: 30 }, { size: 10 }, { size: 40 }, { size: 20 }, { size: 20 }, ]; If the cumulative total exceeds the 50 threshold I would…
gosseti
  • 965
  • 16
  • 40
-1
votes
4 answers

How to flatten the nested array of of objects and duplicate the parent

I have an array of objects that has one of the properties("attributes") as array of objects. var products = [ { "productId": "1", "attributes": [ { "variant":"red", "price": "134.00" …
texpert
  • 185
  • 1
  • 3
  • 14
-1
votes
1 answer

ramda compose function retuns simply an Array of functions

I am trying to convert this functions calls to a compose function But I I use R.compose and write my functions from right-to-left I simply get a function array if I try to execute the composed function. R.sort((a,b) => b - a, R.keys(R.groupBy( t =>…
user991047
  • 315
  • 4
  • 12
-1
votes
2 answers

Concat objects in ramda (project nodejs)

I am trying to apply ramda in my nodejs backend to do a concatenation of objects but I have not been able to establish the relationship of the objects when they are equal. Here I show you the first arrangement: { "ETHBTC": "0.03907000", …
-1
votes
2 answers

Javascript or Ramda Transform JSON By Attributes

I am using Ramda library in my project. is it possible to transform following JSON array from [ { "id": 1, "name": "test", }, { "id": 2, "name": "test2" } ]; To [ { "id": 1, "id": 2, }, { …
MAnI
  • 57
  • 5
-1
votes
2 answers

turn function into ramda pipe/compose

I would like to turn this function: const get1 = (v, d) => path(split(/[[\].]/, d), v); get1("a.d", {a:{d:"f"}}) into a pipe or a compose function without the need of using it like so: get1("a.d")({a:{d:"f"}})
-1
votes
3 answers

When can we pass an unwrapped function as a parameter

In Javascript and many other programming languages we may pass functions as parameters to other functions. This is a common practice in functional programming. We know that a wrapper is required to put a breakpoint there, to see its place in a…
Rivenfall
  • 1,189
  • 10
  • 15
-1
votes
1 answer

Parsing list in ramda

I am working on a project in which i am getting a getting data from backend via api and i need to parse in using ramda. i am not sure how to do it .can anyone help me parse both the data given below { "data": [ { "id":…
Deepak
  • 143
  • 2
  • 10
-1
votes
4 answers

How to convert an array containing arrays of objects to single array witht hose object using Ramda expressions?

I am having a difficult time, there is some bad mapping going on on my code. I have an array containing array of objects like that : [ [{a: 1, b: 2},{a: 1, b: 3} ], [{a: 5, b: 2},{a: 2, b: 5}] ] And I want to make like that : [ {a: 1, b:…
TaouBen
  • 1,165
  • 1
  • 15
  • 41
-1
votes
3 answers

Filtering values in nested array of objects using ramda

I have an array like this from which I am trying to filter out values. The array is like this: const arr = [ { date: "2020-05-18", values: [ { name: "a", value: 1 }, { name: "b", value: 2 } ] }, { date:…
newbie
  • 530
  • 1
  • 9
  • 36