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
9
votes
0 answers

Handling forking on different levels of Tasks

I'm really stuck on handling different levels of Tasks in Ramda. I'm trying to build a script to parse LESS files for comments and build a pattern library site from the data in the comments and inline HTML from an example file. It's all working…
SpaceBeers
  • 13,617
  • 6
  • 47
  • 61
9
votes
3 answers

Mapping over an array of Tasks in Javascript

So I've started looking at Ramda / Folktale. I'm having an issue trying to map over an array of Tasks that comes from a directory. I'm trying to parse file contents. var fs = require('fs'); var util = require('util'); var R = require('ramda'); var…
SpaceBeers
  • 13,617
  • 6
  • 47
  • 61
8
votes
6 answers

Ramda: How to remove keys in objects with empty values?

I have this object: let obj = { matrimonyUrl: 'christian-grooms', search_criteria: 'a:2:{s:6:"gender";s:4:"Male";s:9:"community";s:9:"Christian";}', mothertongue: null, religion: 'Christian', caste: '', country: null }; I need to…
Amit Erandole
  • 11,995
  • 23
  • 65
  • 103
8
votes
2 answers

using ramda group by property and sum results on specified property

I need help transforming an array of objects using ramda; I'd like to group by a specified property sum another property on the resulting set given an array like this: var arr = [ { title: "scotty", age: 22, score: 54, hobby:…
Jonathan Portorreal
  • 2,730
  • 4
  • 21
  • 38
7
votes
3 answers

Ramda: Check if two arrays are equal

I'm still learning functional programming in JavaScript and I enjoy using Ramda a lot. I have two arrays. I want to check if they have the same values, independent of order. I thought this could be done with equals. But apparently R.equals([1, 2],…
J. Hesters
  • 13,117
  • 31
  • 133
  • 249
7
votes
2 answers

Why was "complement" used as a name for the function in ramda.js

I understand the use of ramda's complement function which inverts the return of a predicate. What I can't get my head around is why "complement" was used as a name. const invertPredicate = R.complement(R.identity) invertPredicate(false)…
robstarbuck
  • 6,893
  • 2
  • 41
  • 40
7
votes
2 answers

Cannot find type definition file for 'ramda'

I have a project with Ionic 2 & Angular 2. I use RamdaJS in my code, this is perfectly working with these commands: ionic serve ionic cordova build android ionic cordova run android But when I try to execute this command: ionic cordova build…
Zooly
  • 4,736
  • 4
  • 34
  • 54
7
votes
10 answers

Convert array of objects to one Object using ramda.js

I have an array: var a = [ {id: 1, val: 'a'}, {id: 2, val: 'b'}, {id: 3, val: 'c'}, {id: 4, val: 'd'}, ] And I want to get transform it to: var b = { 1: 'a', 2: 'b', 3: 'c', 4: 'd', } Actually I'm using pure js: var…
n06rin
  • 173
  • 2
  • 9
7
votes
3 answers

How to use pointfree style in JavaScript without losing readability?

When I tried to write JavaScript in pointfree style, I found that if you forced every function in this style, you sometimes lost its readabilty. For example: import R from 'ramda' const ceil = Math.ceil const pagination = { total: 101, …
Jerry
  • 909
  • 7
  • 24
7
votes
2 answers

How to use Ramda to find matching object in Array by key value

Ramda REPL example var portfolio = [{ticker: "aa"}, {ticker: "bb"}]; var ticker = {ticker:"aa"}; var exist = R.find(R.propEq('ticker', ticker), portfolio) console.log(exist) Currently this is giving me undefined, however R.propEq should find…
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
7
votes
3 answers

Where can I find an explanation/summary of symbols used to explain functional programming, specifically Ramda.js?

The API documentation for the JavaScript functional programming library Ramda.js contains symbolic abbreviations but does not provide a legend for understanding these. Is there a place (website, article, cheatsheet, etc.) that I can go to to…
Andrew Willems
  • 11,880
  • 10
  • 53
  • 70
7
votes
2 answers

Point free debugging

So we're using the very nice ramda library at work, which is great because we're able to use a largely point-free style of code. The problem with this is that there are far fewer places to look when things go wrong that point to something in our…
jstaab
  • 3,449
  • 1
  • 27
  • 40
7
votes
2 answers

How come I can pass functions to a lifted R.divide?

Given the following: var average = R.lift(R.divide)(R.sum, R.length) How come this works as a pointfree implementation of average? I don't understand why I can pass R.sum and R.length when they are functions and therefore, I cannot map the lifted…
Chad
  • 2,041
  • 6
  • 25
  • 39
7
votes
5 answers

Recursive "merge" or "extend" with Ramda?

I'm trying to find an equivalent function to Lodash's merge using Ramda that does a recursive object key-based "merge" or "extend". The behavior is similar to the following: let merged = R.someMethod( { name: 'Matt', address: { street:…
Himmel
  • 3,629
  • 6
  • 40
  • 77
7
votes
2 answers

Ramda.js: Arguments to list

Trying to figure out Ramda here. Does Ramda have a method to turn arguments to a list? E.g: R.argumentsToList(1)(2) => [1, 2] The problem that I'm actually facing is that my function is passed 2 arguments and I need to work with both arguments, yet…
Oliver
  • 3,981
  • 2
  • 21
  • 35
1 2
3
79 80