is-equal-value
v0.1.2
Published
用于检测多个值是否相等,即使它们未通过全等员运算符(===)的检测
Downloads
7
Readme
is-equal-value
用于检测多个值是否逻辑相等,支持 RegExp、Date 等特殊对象的判断,暂未支持 Set、Map
使用
import { isEqual, isSameArray } from "./index.js";
let objectA = { a: 1, c: [1, 2, 3], d: /a/g, e: Date.now() };
let objectB = { c: [1, 2, 3], a: 1, d: new RegExp('a', 'g'), e: Date.now() };
isEqual(objectA, objectB); // 判断多个值是否逻辑相等
// => true
let arrayA = ['a', 'b', 'c'];
let arrayB = ['c', 'a', 'b'];
isSameArray(arrayA, arrayB); // 判断多个数组是否相等,数组中第一层的成员会进行排序处理
// true