How to use the curry function from ramda
Find comprehensive JavaScript ramda.curry code examples handpicked from public code repositorys.
27 28 29 30 31 32 33 34 35 36
items: R.adjust(Component.update(counterAction), idx) }, model) }) // View const view = R.curry((action$, model) => h('div.list', [ h('button', {on: {click: [action$, Action.Reverse()]}}, 'Reverse'), h('button', {on: {click: [action$, Action.Add()]}}, 'Add'), h('ul', R.mapIndexed((item, idx) =>
92
0
0
37 38 39 40 41 42 43 44 45 46
})}, model) }); // View const viewCounter = R.curry((actions, c) => { const [id, model] = c; console.log('viewCounter', id, model); return counter.viewWithRemoveButton({ actions: R.compose(actions, Action.Modify(id)),
92
0
72
+ 3 other calls in file
65 66 67 68 69 70 71 72 73 74
}) }) // View const viewTodo = R.curry((action$, todo) => { return Todo.view({ action$: forwardTo(action$, Action.Modify(todo)), remove$: forwardTo(action$, R.always(Action.Remove(todo))), }, todo)
92
0
2
+ 3 other calls in file
43 44 45 46 47 48 49 50 51 52
const viewCounter = R.curry((actions, c) => { const [id, model] = c; return counter.view(R.compose(actions, Action.Modify(id)), model); }); const view = R.curry(function (actions, model) { const counters = R.map(viewCounter(actions), model.counters); return h('div', R.concat([h('button.rm', {on: {click: [actions, Action.Remove()]}}, 'Remove'), h('button.add', {on: {click: [actions, Action.Insert()]}}, 'Add')], counters)
92
0
72
+ 3 other calls in file
31 32 33 34 35 36 37 38 39 40
})}, model) }) // View const viewCounter = R.curry((actions, [id, model]) => counter.view({ actions: R.compose(actions, Action.Modify(id)), remove: R.compose(actions, R.always(Action.Remove(id))), }, model))
92
0
72
+ 3 other calls in file
GitHub: DFEAGILEDEVOPS/MTC
78 79 80 81 82 83 84 85 86 87
* Prefix a string with '@' and its index * @param {number} idx * @param {string} s * @return {function(): string} */ const paramNameWithIdx = R.curry((idx, s) => '@' + s + idx) /** * Return a function that takes the keys from an object joins them together into a list * of sql parameter identifiers.
14
12
11
39 40 41 42 43 44 45 46 47 48
})}, model) }); // View const viewCounter = R.curry((actions$, c) => { const [id, model] = c; console.log('viewCounter', id, model); return counter.viewWithRemoveButton({ actions$: forwardTo(actions$, Action.Modify(id)),
91
0
2
+ 19 other calls in file
2 3 4 5 6 7 8 9 10 11 12
const {curry, isNil, pathSatisfies, test} = require('ramda'); const rp = require('request-promise'); const authHeader = require('./authHeader'); const baseUrl = require('./baseUrl'); module.exports = curry(async (path,qs) => { let options = { json: true, headers: { Authorization: authHeader(),
15
10
0
GitHub: SeanCannon/prettycats
7 8 9 10 11 12 13 14 15 16 17 18
isStringOfLengthAtLeast = __.ofLength(String, 'gte'), isStringOfLengthAtMost = __.ofLength(String, 'lte'), isStringLongerThan = __.ofLength(String, 'gt'), isStringShorterThan = __.ofLength(String, 'lt'); const isStringContaining = R.curry((subStr, str) => { return R.compose(R.not, R.equals(-1), R.indexOf(subStr))(str); }); const isStringMatching = R.curry((pattern, str) => {
2
11
0
+ 4 other calls in file
7 8 9 10 11 12 13 14 15 16 17 18 19
const isMatch = ({ constructor: { name } }) => name === constructorName return findIndex(isMatch, plugins) }) const injectPluginIndex = curry((constructorName, fn, config) => { const i = getPluginIndex(constructorName, config) i === -1 && error(`No plugin with constructor name ${constructorName} was found`) return fn(i)
2
5
0
+ 31 other calls in file
GitHub: ebigram/emojisense
16 17 18 19 20 21 22 23 24 25
} activate() { this.ep.loadProperties(); this.disposables = new _eventKit.CompositeDisposable(); //console.log("activate") const editoHandler = R.curry(this.handleEditorDidLoad)(this.ep); global.inkdrop.onEditorLoad(editoHandler.bind(this)); } deactivate() { if (this.disposables) {
0
10
0
GitHub: homer0/packages
307 308 309 310 311 312 313 314 315 316 317
*/ /** * @type {RenderFn} */ const render = R.curry((options, column, block) => { const prefix = `${' '.repeat(column)} * `; const usePrintWidth = options.jsdocPrintWidth || options.printWidth; const width = usePrintWidth - prefix.length; const lines = [];
1
9
0
GitHub: mvp-rockets/lib-core
2 3 4 5 6 7 8 9 10 11 12 13
const ApiError = require('../utilities/api-error'); const HTTP_CONSTANT = require('../utilities/http-constant'); const notNil = R.compose(R.not, R.isNil); const mapValueAndRules = R.curry((data, allRules) => { const keys = R.keys(allRules); return R.map((key) => { const value = data ? data[key] : undefined; const rules = allRules[key];
4
2
2
+ 413 other calls in file
0 1 2 3 4 5 6 7 8 9 10
const R = require('ramda'); const Result = require('folktale/result'); const whenResult = require('./whenResult'); const { ifElse } = require('./ifElse'); const executeIfResultIsSuccessful = R.curry(async (fn, result) => { if (Result.hasInstance(result)) { return whenResult((value) => fn(value))(result); } return Result.Error('Return type of execution was not type of folktale/result.');
4
2
0
7 8 9 10 11 12 13 14 15 16
// lensStringPath :: String -> Object const lensStringPath = R.pipe(splitPath, R.lensPath); // getByStringPath :: String -> Object const getByStringPath = R.pipe(splitPath, R.path); // doArrayByPath :: Function -> String -> Object -> Object -> Object const doArrayByPath = arrayFn => R.curry((objPath, data, object) => R.pipe( getByStringPath(objPath), arrayFn(data), R.set(lensStringPath(objPath), R.__, object)
0
2
0
+ 2 other calls in file
GitHub: arith-lang/proto-impl
339 340 341 342 343 344 345 346 347 348 349 350
return listTail(lst); } return nil; } member = R.curry(member); function find(pred, list) { if (isNull(lst)) { return lst;
1
1
0
+ 15 other calls in file
2 3 4 5 6 7 8 9 10 11 12
* Author: Luis Atencio */ const R = require('ramda'); // checkType :: Type -> Type -> Type | TypeError const checkType = R.curry(function(typeDef, obj) { if(!R.is(typeDef, obj)) { let type = typeof obj; throw new TypeError(`Type mismatch. Expected [${typeDef}] but found [${type}]`); }
0
1
1
GitHub: alvaro-cuesta/aoc-js
47 48 49 50 51 52 53 54 55 56 57 58
), R.indexBy(R.prop('id')), R.map(R.omit(['id'])), ) const monkeyRoundMut = R.curry((commonMultiple, lowWorry, monkeys) => { for (const id of Object.keys(monkeys)) { const monkey = monkeys[id] const items = monkey.items
0
1
0
GitHub: nbenns/higher-validation
18 19 20 21 22 23 24 25 26 27 28
return Failure([errMessage]); } } ); const HVXor = Type((success, failure) => curry((firstType, secondType, value) => Just(xorValidation) .ap(Maybe.fromNullable(firstType)) .ap(Maybe.fromNullable(secondType)) .ap(Maybe.fromNullable(value))
0
1
0
+ 7 other calls in file
ramda.clone is the most popular function in ramda (30311 examples)