Socket
Socket
Sign inDemoInstall

lodash.findlast

Package Overview
Dependencies
Maintainers
5
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.findlast - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

39

index.js
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* lodash 3.1.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors

@@ -11,5 +11,26 @@ * Available under MIT license <https://lodash.com/license>

baseEachRight = require('lodash._baseeachright'),
baseFind = require('lodash._basefind');
baseFind = require('lodash._basefind'),
baseFindIndex = require('lodash._basefindindex'),
isArray = require('lodash.isarray');
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new find function.
*/
function createFind(eachFunc, fromRight) {
return function(collection, predicate, thisArg) {
predicate = baseCallback(predicate, thisArg, 3);
if (isArray(collection)) {
var index = baseFindIndex(collection, predicate, fromRight);
return index > -1 ? collection[index] : undefined;
}
return baseFind(collection, predicate, eachFunc);
}
}
/**
* This method is like `_.find` except that it iterates over elements of

@@ -23,4 +44,3 @@ * `collection` from right to left.

* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration. If a property name or object is provided it is used to
* create a "_.property" or "_.matches" style callback respectively.
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.

@@ -30,10 +50,9 @@ * @returns {*} Returns the matched element, else `undefined`.

*
* _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; });
* _.findLast([1, 2, 3, 4], function(n) {
* return n % 2 == 1;
* });
* // => 3
*/
function findLast(collection, predicate, thisArg) {
predicate = baseCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEachRight);
}
var findLast = createFind(baseEachRight, true);
module.exports = findLast;
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas,
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>

@@ -4,0 +4,0 @@

{
"name": "lodash.findlast",
"version": "3.0.0",
"version": "3.1.0",
"description": "The modern build of lodash’s `_.findLast` as a module.",

@@ -22,4 +22,6 @@ "homepage": "https://lodash.com/",

"lodash._baseeachright": "^3.0.0",
"lodash._basefind": "^3.0.0"
"lodash._basefind": "^3.0.0",
"lodash._basefindindex": "^3.0.0",
"lodash.isarray": "^3.0.0"
}
}

@@ -1,2 +0,2 @@

# lodash.findlast v3.0.0
# lodash.findlast v3.1.0

@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.findLast` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.

See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.findlast) for more details.
See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.findlast) for more details.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc