codecamp

Lodash_.isEqualWith

 (value, other, [customizer])

这个方法类似_.isEqual。 除了它接受一个 customizer 用来定制比较值。 如果 customizer 返回 undefined 将会比较处理方法代替。 customizer 会传入6个参数:(objValue, othValue [, index|key, object, other, stack])

添加版本

4.0.0

参数

  1. value (*): 用来比较的值。
  2. other (*): 另一个用来比较的值。
  3. [customizer] (Function): 用来定制比较值的函数。

返回

(boolean): 如果 两个值完全相同,那么返回 true,否则返回 false。

例子

function isGreeting(value)
 {  return /^h(?:i|ello)$/.test(value);} 
function customizer(objValue, othValue)
 {  if (isGreeting(objValue) && isGreeting(othValue))
 {    return true;  }} 
var array = ['hello', 'goodbye'];var other = ['hi', 'goodbye'];
 _.isEqualWith(array, other, customizer);
// => true


Lodash _.isEqual
Lodash _.isError
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Lodash 简介

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }