UNPKG

@glyph-cat/equality

Version:
2 lines (1 loc) 1.05 kB
"use strict";function t(t,r){if(!Object.is(t?.length,r?.length))return!1;for(let e=0;e<t.length;e++)if(!Object.is(t[e],r[e]))return!1;return!0}function r(t){return"object"==typeof t&&!function(t){return Object.is(t,null)}(t)}function e(t,e){if(r(t)&&r(e)){const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const u=r[o],c=n[o];if(u!==c)return!1;if(!Object.is(t[u],e[c]))return!1}return!0}return Object.is(t,e)}exports.BUILD_HASH="4b810e9ebb1acd002621ff1dd28db9481a8216f7",exports.BUILD_TYPE="CJS",exports.VERSION="1.3.0",exports.arrayIsShallowEqual=t,exports.arrayOrObjectIsShallowEqual=function(r,n){const o=Array.isArray(r),u=Array.isArray(n);return o===u&&(o&&u?t(r,n):e(r,n))},exports.isCaseInsensitiveEqual=function(t,r){return t?.toLowerCase?.()===r?.toLowerCase?.()},exports.isJSONequal=function(t,r){return JSON.stringify(t)===JSON.stringify(r)},exports.isLocaleCaseInsensitiveEqual=function(t,r,e){return t?.toLocaleLowerCase?.(e)===r?.toLocaleLowerCase?.(e)},exports.objectIsShallowEqual=e;