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
0
votes
1 answer

Ramda filter if not match

I would like to filter all elements that don't match a condition. I was able to get this to work: var a = [1,2,3]; function notSame(x,y) { R.pipe( R.equals, R.not ) } R.filter( R.pipe( R.equals(1), R.not), a ) // [2,3] But…
JuanCaicedo
  • 3,132
  • 2
  • 14
  • 36
0
votes
1 answer

Too many calls to R.ap?

I have a list, which contains items such as this: [{name:...}, {name:...}], ... I would like to extract only those elements, where name matches to any in a set of regular expressions. I was able to do it like so: const cards = yield ... //Network…
Vasili Sviridov
  • 191
  • 2
  • 4
  • 14
0
votes
3 answers

Executing a list of functions on an array

I'm getting to grips with using functional programming beyond a simple map or two. I have a situation where I want to be able to filter some elements from an array of objects, based on a particular field of those objects. It's a contrived example,…
chooban
  • 9,018
  • 2
  • 20
  • 36
0
votes
3 answers

Ramda.js - Slice Array's Inner Values

What would be the best way to achieve this using Ramda.js? function innerVals(array) { const lengthMinus1 = array.length - 1; return array.slice(1, lengthMinus1); } I cannot seem to find a good way to slice until length - 1 without storing that…
wpcarro
  • 1,528
  • 10
  • 13
0
votes
2 answers

Optimal way to build an associative array using Ramba, underscore or plain Javascript?

Lately I find myself using associative arrays (or hastables) more and more in my applications (advantages being lookup speed, duplicate removal etc). Here is typical code taken from my application - var parent1 = { id: 5, name: 'parent 1'},…
Joseph King
  • 5,089
  • 1
  • 30
  • 37
0
votes
0 answers

Idea loose ramda.js

It was nice code, that do, what it have to do. Then I try to export it. Than "make project" and after that it dosnt work.
user5770563
  • 57
  • 1
  • 9
0
votes
1 answer

Idiomatic Ramda for generating higher order functions?

My goal is to create a custom map function that first needs to filter the list to remain, for example, only even items before invoking the supplied function on every item. I do need the function to be curried and for the first parameter to be the…
0
votes
1 answer

Why Ramdajs.filter() works in my code and Ramdajs.find() not?

I have a js object like var storage = [ 1:{"index":1, "label": abc, "value": 33}, 2:{"index":2, "label": def, "value": 43}, etc. ]; so, now i need to extract a given inner object given a "label" value i find working: R.filter( R.propEq( "label",…
leandro713
  • 1,268
  • 1
  • 10
  • 17
0
votes
3 answers

How to sum n-arrays by index using Ramda

I've been learning Ramda and wanted to know how to sum n-arrays by index. Below is what I was able to do with 2 arrays. How can I make this method scale? i.e. I'd like to be able to do this: sumByIndex( arr1, arr2, ..., arrn ) Given lists x and y,…
Pete
  • 3,246
  • 4
  • 24
  • 43
0
votes
1 answer

How to make functions callable with multiple parameters, so instead of f(x)(y) you can do f(x,y)

given the following data structure var categories = [ {_id: 1, order: 0, ancestors: []}, {_id: 2, order: 0, ancestors: [1]}, {_id: 3, order: 0, ancestors: [1]}, {_id: 4, order: 0, ancestors: []}, {_id: 5, order: 0, ancestors:…
Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156
0
votes
1 answer

RangeError: Maximum call stack size exceeded (Babel Ramda)

This code produces the stack trace below it: import R from 'ramda'; function quicksort(list) { if ( R.isEmpty(list) ) return list; let pivot = R.head(list); let lesser = R.filter( e => e < pivot , list ); let greater = R.filter( e => e >=…
Ivan -Oats- Storck
  • 4,096
  • 3
  • 30
  • 39
0
votes
1 answer

generic filtering of JSON objects in js using Ramda

I like the implementation to be as generic and functional (as in functional programming) as possible, but generally speaking, i'm expecting a json objected with the following structure: [ { id: number, prop1: string, prop2: number, …
0
votes
1 answer

Zipping and uploading files using PhoneGap and JSZip

I've got code that reads a local folder, then zips up relevant files and uploads them to a server: var dirEntry = fileSystem.createReader(); dirEntry.readEntries( function (entries) { if (entries.length === 0) return; …
ilitirit
  • 16,016
  • 18
  • 72
  • 111
0
votes
1 answer

Ramda does not provide deep mixin?

var _ = require('ramda'); var obj1 = { innerNum: 1, innerObj: { innerStr: 'a', innerStrB: 'Z' } }; var obj2 = { innerNum: 2, innerObj: { innerStr: 'b' } }; var mixedObj = _.mixin(obj1,…
Daniel
  • 1,562
  • 3
  • 22
  • 34
0
votes
2 answers

Why call void on an unknown argument before returning another function call?

What's the significance of calling void before returning in ramda's arity function?
c24w
  • 7,421
  • 7
  • 39
  • 47