A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/lodash/lodash/wiki/Changelog below:

Changelog · lodash/lodash Wiki · GitHub

See the v4.0.0 release notes for an overview of what’s new in 4.0.0. Use lodash-migrate, lodash-codemods, & eslint-plugin-lodash to help migrate pre-4 lodash code to the latest release.

var wrapped = _([1, 2, 3]);

// in 3.10.1
wrapped.forEach(function(n) { console.log(n); });
// ➜ returns the lodash wrapper without logging until `value` is called
wrapped.forEach(function(n) { console.log(n); }).value();
// ➜ logs each value from left to right and returns the array

// in 4.0.0
wrapped.forEach(function(n) { console.log(n); });
// ➜ logs each value from left to right and returns the array
 // in 3.10.1
 var chunk = require('lodash/array/chunk');

 // in 4.0.0
 var chunk = require('lodash/chunk');
var objects = [{ 'a': 1 }, { 'a': 2 }];

// in 3.10.1
_.pluck(objects, 'a'); // ➜ [1, 2]
_.map(objects, 'a'); // ➜ [1, 2]

// in 4.0.0
_.map(objects, 'a'); // ➜ [1, 2]
 var objects = [{ 'a': 1 }, { 'a': 2 }];
 var context = { 'b': 5 };

 function callback(item) {
   return item.a + this.b;
 }

 // in 3.10.1
 _.map(objects, callback, context);

 // in 4.0.0
 _.map(objects, _.bind(callback, context));
var array = [1, 2, 3],
    objects = [{ 'a': 1 }, { 'a': 2 }];

// in 3.10.1
_.max(array); // ➜ 3
_.max(objects, 'a'); // ➜ { 'a': 2 }

_.min(array); // ➜ 1
_.min(objects, 'a'); // ➜ { 'a': 1 }

// in 4.0.0
_.max(array); // ➜ 3
_.maxBy(objects, 'a'); // ➜ { 'a': 2 }

_.min(array); // ➜ 1
_.minBy(objects, 'a'); // ➜ { 'a': 1 }
Low Risk Compatibility Warnings
var wrapped = _([1, 2, 3]);

// in 2.4.1
wrapped.forEach(function(n) { console.log(n); });
// ➜ logs each value from left to right and returns the lodash wrapper

// in 3.0.0
wrapped.forEach(function(n) { console.log(n); });
// ➜ returns the lodash wrapper without logging until `value` is called
wrapped.forEach(function(n) { console.log(n); }).value();
// ➜ logs each value from left to right and returns the array
var array = [1],
    wrapped = _(array);

// in 2.4.1
var a = wrapped.push(2), // pushes `2` to `array`
    b = wrapped.push(3); // pushes `3` to `array`

a.value(); // ➜ returns `array`; [1, 2, 3]
b.value(); // ➜ returns `array`; [1, 2, 3]

// in 3.0.0
var a = wrapped.push(2), // creates a lazy sequence to push `2` to `array`
    b = wrapped.push(3); // creates a lazy sequence to push `3` to `array`

a.value(); // ➜ pushes `2` to `array` and returns `array`; [1, 2]
b.value(); // ➜ pushes `3` to `array` and returns `array`; [1, 2, 3]
a.value(); // ➜ pushes `2` to `array` and returns `array`; [1, 2, 3, 2]
b.value(); // ➜ pushes `3` to `array` and returns `array`; [1, 2, 3, 2, 3]

// use `_#commit` to commit a sequence and continue chaining
var a = wrapped.push(2).commit(), // pushes `2` to `array`
    b = wrapped.push(3).commit(); // pushes `3` to `array`

a.value(); // ➜ returns `array`; [1, 2, 3]
b.value(); // ➜ returns `array`; [1, 2, 3]
var array = [1, [[2], 3]],
    objects = [{ 'a': [1] }, { 'a': [2, 3] }];

// in 2.4.1
_.flatten(array); // ➜ [1, 2, 3]
_.flatten(objects, 'a'); // [1, 2, 3]

// in 3.0.0
_.flatten(array); // ➜ [1, [2], 3]
_.flattenDeep(array); // ➜ [1, 2, 3]
_(objects).pluck('a').flatten().value(); // [1, 2, 3]
var string = '<%= o.a %>',
    options = { 'variable': 'o' },
    data = { 'a': 'b' };

// in 2.4.1
_.template(string, data, options); // ➜ 'b'

// in 3.0.0
_.template(string, options)(data); // ➜ 'b'
var array = [1, 2, 3],
    lessThanTwo = function(value) { return value < 2; },
    greaterThanTwo = function(value) { return value > 2; };

// in 2.4.1
_.first(array); // ➜ 1
_.first(array, 2); // ➜ [1, 2]
_.first(array, lessThanTwo);   // ➜ [1]

_.last(array); // ➜ 3
_.last(array, 2); // ➜ [2, 3]
_.last(array, greaterThanTwo); // ➜ [3]

// in 3.0.0
_.first(array); // ➜ 1
_.take(array, 2); // ➜ [1, 2]
_.takeWhile(array, lessThanTwo); // ➜ [1]

_.last(array); // ➜ 3
_.takeRight(array, 2); // ➜ [2, 3]
_.takeRightWhile(array, greaterThanTwo); // ➜ [3]
var array = [1, 2, 3],
    lessThanTwo = function(value) { return value < 2; },
    greaterThanTwo = function(value) { return value > 2; };

// in 2.4.1
_.initial(array); // ➜ [1, 2]
_.initial(array, 2); // ➜ [1]
_.initial(array, greaterThanTwo); // ➜ [1, 2]

_.rest(array); // ➜ [2, 3]
_.rest(array, 2); // ➜ [3]
_.rest(array, lessThanTwo); // ➜ [2, 3]

// in 3.0.0
_.initial(array); // ➜ [1, 2]
_.dropRight(array, 2); // ➜ [1]
_.dropRightWhile(array, greaterThanTwo); // ➜ [1, 2]

_.rest(array); // ➜ [2, 3]
_.drop(array, 2); // ➜ [3]
_.dropWhile(array, lessThanTwo); // ➜ [2, 3]
Low Risk Compatibility Warnings

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4