How to use the __ function from ramda

Find comprehensive JavaScript ramda.__ code examples handpicked from public code repositorys.

ramda.__ is a placeholder value used in Ramda.js functions to indicate that a particular argument should be partially applied.

12
13
14
15
16
17
18
19
20
21
var kb = require('../../');
var stream = flyd.stream;

var _require2 = require('ramda');

var __ = _require2.__;
var liftN = _require2.liftN;
var curry = _require2.curry;
var pipe = _require2.pipe;
var always = _require2.always;
fork icon1
star icon3
watch icon3

68
69
70
71
72
73
74
75
76
77
78
        ((key) => configDict, () => string) => ( (key) => string )
*/
const load_optional_str_config = load_config(
    R.__,
    R.prop('val'),
    R.__
)


/*
    Signature:
fork icon1
star icon0
watch icon13

+ 180 other calls in file

How does ramda.__ work?

ramda.__ is a placeholder value used in Ramda.js functions to indicate that a particular argument should be partially applied. When a function in Ramda.js encounters the __ value as an argument, it treats it as a placeholder that should be replaced with a value when the function is partially applied. For example, consider the following Ramda.js function that concatenates two strings: javascript Copy code {{{{{{{ const { concat } = require('ramda'); const concatStrings = concat('Hello, '); console.log(concatStrings('world')); // Output: 'Hello, world' In this example, we use concat to create a new function called concatStrings that concatenates the string 'Hello, ' with another string. The first argument to concat is partially applied using the __ placeholder value, indicating that it should be replaced with a value when the function is called. We then call concatStrings with the string 'world', which results in the concatenated string 'Hello, world'. By using the __ placeholder value in this way, we can create new functions that are partially applied with specific arguments. This can be useful for creating more flexible and reusable code, as well as for improving the performance of certain operations. Overall, __ is an important feature of Ramda.js that allows you to create partially applied functions with greater precision and control.

-3
fork icon0
star icon0
watch icon0

+ 2 other calls in file

-3
fork icon0
star icon0
watch icon0

+ 3 other calls in file

Ai Example

1
2
3
4
5
const { map, multiply } = require("ramda");

const doubleNumbers = map(multiply(__, 2));

console.log(doubleNumbers([1, 2, 3])); // Output: [2, 4, 6]

In this example, we create a new function called doubleNumbers that uses map and multiply to double the values in an array of numbers. We use the __ placeholder value to indicate that multiply should be partially applied with the number 2, so that it multiplies each number in the array by 2. When we call doubleNumbers with an array of numbers, Ramda.js applies the multiply(__, 2) function to each number in the array, resulting in a new array where each number is doubled. Using __ in this way allows us to create a more flexible and reusable function that can be easily modified to multiply numbers by other values as well.

8
9
10
11
12
13
14
15
16
17
18
19
20
var program = require('commander');
var escodegen = require('escodegen');
var R = require('ramda');




var _ = R.__;


//  template :: String
var template = fs.readFileSync(path.join(__dirname, 'template.js'),
                               {encoding: 'utf8'});
fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)