@glyph-cat/equality
Version:
General purpose equality-checking presets.
3 lines (2 loc) • 1.26 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Equality={})}(this,function(t){"use strict";function e(t,e){if(!Object.is(t?.length,e?.length))return!1;for(let n=0;n<t.length;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function n(t){return"object"==typeof t&&!function(t){return Object.is(t,null)}(t)}function r(t,e){if(n(t)&&n(e)){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let f=0;f<n.length;f++){const u=n[f],o=r[f];if(u!==o)return!1;if(!Object.is(t[u],e[o]))return!1}return!0}return Object.is(t,e)}t.BUILD_HASH="4b810e9ebb1acd002621ff1dd28db9481a8216f7",t.BUILD_TYPE="UMD",t.VERSION="1.3.0",t.arrayIsShallowEqual=e,t.arrayOrObjectIsShallowEqual=function(t,n){const f=Array.isArray(t),u=Array.isArray(n);return f===u&&(f&&u?e(t,n):r(t,n))},t.isCaseInsensitiveEqual=function(t,e){return t?.toLowerCase?.()===e?.toLowerCase?.()},t.isJSONequal=function(t,e){return JSON.stringify(t)===JSON.stringify(e)},t.isLocaleCaseInsensitiveEqual=function(t,e,n){return t?.toLocaleLowerCase?.(n)===e?.toLocaleLowerCase?.(n)},t.objectIsShallowEqual=r});
//# sourceMappingURL=index.js.map