Thanks to visit codestin.com
Credit goes to github.com

Skip to content

0.11.0 upgrade guide #892

@davidchambers

Description

@davidchambers

Changes: v0.10.0...v0.11.0

Removals:

Deprecations (to be removed in v0.12.0):

Changes:

Additions:


R.__ placeholder

Prior to v0.11.0 certain functions respected the R.__ placeholder. For example:

var isPositive = R.gt(R.__, 0);

isPositive(0);  // => false
isPositive(1);  // => true

All Ramda's fixed-arity functions now respect the R.__ placeholder in any position(s). For example:

var greet = R.replace('{name}', R.__, 'Welcome, {name}. Enjoy your stay.');

greet('Alice');  //=> 'Welcome, Alice. Enjoy your stay.'

Given:

var f = function(a, b, c) { return [a, b, c]; };
var g = R.curry(f);
var _ = R.__;

the following are equivalent:

g(_, 2, 3)(1)
g(1, _, 3)(2)
g(1, 2, _)(3)

g(1, _, _)(2)(3)
g(_, 2, _)(1)(3)
g(_, _, 3)(1)(2)

g(1, _, _)(2, 3)
g(_, 2, _)(1, 3)
g(_, _, 3)(1, 2)

g(1, _, _)(_, 3)(2)
g(_, 2, _)(_, 3)(1)
g(_, _, 3)(_, 2)(1)

g(_, _, _)(_, _)(_)(1, 2, 3)
g(_, _, _)(1, _, _)(_, _)(2, _)(_)(3)

Functions returned by R.curry and R.curryN also respect R.__.


Invariants

Thanks to #819, #836, and #856, the following invariants now hold throughout the library:

  1. For every curried function f where f.length > 0, applying f to no arguments gives a function equivalent to f.
  2. For every curried function f where f.length > 0, applying f to R.__ gives a function equivalent to f.
  3. For every curried function f where f.length > 1, applying f to any value other than R.__ gives a function g with length f.length - 1. All three invariants hold for g and all "descendants" of g.

The invariants also hold for functions returned by R.curry and R.curryN.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions