- 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 - confirmTo method
Syntax
_.conformsTo(object, source)
Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.
Arguments
object (Object) − The object to inspect.
source (Object) − The object of property predicates to conform to.
Output
(boolean) − Returns true if object conforms, else false.
Example
var _ = require('lodash'); var object = { 'a': 1, 'b': 2 }; console.log(_.conformsTo(object, { 'b': function(n) { return n > 1; } })); console.log(_.conformsTo(object, { 'b': function(n) { return n > 2; } }));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
true false
lodash_lang.htm
Advertisements
To Continue Learning Please Login
Login with Google