Lodash教程

Lodash isMatch method

语法

_.isMatch(object, source)
Performs a partial deep comparison between object and source to determine if object contains equivalent property values.

参数

object (Object) − The value to inspect. source (Object) − The object of property values to match.

输出

(boolean) − Returns true if object is a match, else false.

实例

var _ = require('lodash');
var object = { 'a': 1, 'b': 2 };
 
console.log(_.isMatch(object, { 'b': 2 }));
console.log(_.isMatch(object, { 'b': 1 }));
Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

输出

true
false
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4