- Lodash Tutorial
- Lodash - Home
- Lodash - Overview
- Lodash - Environment Setup
- Lodash - Array
- Lodash - Collection
- Lodash - Date
- Lodash - Function
- Lodash - Lang
- Lodash - Math
- Lodash - Number
- Lodash - Object
- Lodash - Seq
- Lodash - String
- Lodash - Util
- Lodash - Properties
- Lodash - Methods
- Lodash Useful Resources
- Lodash - Quick Guide
- Lodash - Useful Resources
- Lodash - Discussion
Lodash - iteratee method
Syntax
_.iteratee([func=_.identity])
Creates a function that invokes func with the arguments of the created function. If func is a property name, the created function returns the property value for a given element. If func is an array or object, the created function returns true for elements that contain the equivalent source properties, otherwise it returns false.
Arguments
[func=_.identity] (*) − The value to convert to a callback.
Output
(Function) − Returns the callback.
Example
var _ = require('lodash'); var users = [ { 'user': 'Joe', 'age': 36, 'active': true }, { 'user': 'Robert', 'age': 40, 'active': false } ]; var result = _.filter(users, _.iteratee({ 'user': 'Joe', 'active': true })); console.log(result);
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
[ { user: 'Joe', age: 36, active: true } ]
lodash_util.htm
Advertisements
To Continue Learning Please Login
Login with Google