Comparing version 3.0.1 to 4.0.0
154
deep-eql.js
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.deepEqual = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.deepEqual = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -211,4 +211,5 @@ /* globals Symbol: false, Uint8Array: false, WeakMap: false */ | ||
case 'WeakSet': | ||
return leftHandOperand === rightHandOperand; | ||
case 'Error': | ||
return leftHandOperand === rightHandOperand; | ||
return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options); | ||
case 'Arguments': | ||
@@ -415,3 +416,2 @@ case 'Int8Array': | ||
*/ | ||
function objectEqual(leftHandOperand, rightHandOperand, options) { | ||
@@ -462,3 +462,7 @@ var leftHandKeys = getEnumerableKeys(leftHandOperand); | ||
(function (global){ | ||
'use strict'; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.typeDetect = factory()); | ||
}(this, (function () { 'use strict'; | ||
@@ -471,4 +475,6 @@ /* ! | ||
var promiseExists = typeof Promise === 'function'; | ||
var globalObject = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : self; // eslint-disable-line | ||
var isDom = 'location' in globalObject && 'document' in globalObject; | ||
/* eslint-disable no-undef */ | ||
var globalObject = typeof self === 'object' ? self : global; // eslint-disable-line id-blacklist | ||
var symbolExists = typeof Symbol !== 'undefined'; | ||
@@ -502,3 +508,3 @@ var mapExists = typeof Map !== 'undefined'; | ||
*/ | ||
module.exports = function typeDetect(obj) { | ||
function typeDetect(obj) { | ||
/* ! Speed optimisation | ||
@@ -566,3 +572,5 @@ * Pre: | ||
if (isDom) { | ||
// Not caching existence of `window` and related properties due to potential | ||
// for `window` to be unset before tests in quasi-browser environments. | ||
if (typeof window === 'object' && window !== null) { | ||
/* ! Spec Conformance | ||
@@ -575,3 +583,3 @@ * (https://html.spec.whatwg.org/multipage/browsers.html#location) | ||
*/ | ||
if (obj === globalObject.location) { | ||
if (typeof window.location === 'object' && obj === window.location) { | ||
return 'Location'; | ||
@@ -599,66 +607,74 @@ } | ||
*/ | ||
if (obj === globalObject.document) { | ||
if (typeof window.document === 'object' && obj === window.document) { | ||
return 'Document'; | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray | ||
* Test: `Object.prototype.toString.call(navigator.mimeTypes)`` | ||
* - IE <=10 === "[object MSMimeTypesCollection]" | ||
*/ | ||
if (obj === (globalObject.navigator || {}).mimeTypes) { | ||
return 'MimeTypeArray'; | ||
} | ||
if (typeof window.navigator === 'object') { | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray | ||
* Test: `Object.prototype.toString.call(navigator.mimeTypes)`` | ||
* - IE <=10 === "[object MSMimeTypesCollection]" | ||
*/ | ||
if (typeof window.navigator.mimeTypes === 'object' && | ||
obj === window.navigator.mimeTypes) { | ||
return 'MimeTypeArray'; | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray | ||
* Test: `Object.prototype.toString.call(navigator.plugins)`` | ||
* - IE <=10 === "[object MSPluginsCollection]" | ||
*/ | ||
if (obj === (globalObject.navigator || {}).plugins) { | ||
return 'PluginArray'; | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray | ||
* Test: `Object.prototype.toString.call(navigator.plugins)`` | ||
* - IE <=10 === "[object MSPluginsCollection]" | ||
*/ | ||
if (typeof window.navigator.plugins === 'object' && | ||
obj === window.navigator.plugins) { | ||
return 'PluginArray'; | ||
} | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` | ||
* Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` | ||
* - IE <=10 === "[object HTMLBlockElement]" | ||
*/ | ||
if (obj instanceof HTMLElement && obj.tagName === 'BLOCKQUOTE') { | ||
return 'HTMLQuoteElement'; | ||
} | ||
if ((typeof window.HTMLElement === 'function' || | ||
typeof window.HTMLElement === 'object') && | ||
obj instanceof window.HTMLElement) { | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` | ||
* Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` | ||
* - IE <=10 === "[object HTMLBlockElement]" | ||
*/ | ||
if (obj.tagName === 'BLOCKQUOTE') { | ||
return 'HTMLQuoteElement'; | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltabledatacellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('td')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj instanceof HTMLElement && obj.tagName === 'TD') { | ||
return 'HTMLTableDataCellElement'; | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltabledatacellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('td')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj.tagName === 'TD') { | ||
return 'HTMLTableDataCellElement'; | ||
} | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltableheadercellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('th')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj instanceof HTMLElement && obj.tagName === 'TH') { | ||
return 'HTMLTableHeaderCellElement'; | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltableheadercellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('th')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj.tagName === 'TH') { | ||
return 'HTMLTableHeaderCellElement'; | ||
} | ||
} | ||
@@ -835,8 +851,10 @@ } | ||
.slice(toStringLeftSliceLength, toStringRightSliceLength); | ||
}; | ||
} | ||
module.exports.typeDetect = module.exports; | ||
return typeDetect; | ||
}))); | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}]},{},[1])(1) | ||
}); | ||
}); |
@@ -210,4 +210,5 @@ 'use strict'; | ||
case 'WeakSet': | ||
return leftHandOperand === rightHandOperand; | ||
case 'Error': | ||
return leftHandOperand === rightHandOperand; | ||
return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options); | ||
case 'Arguments': | ||
@@ -414,3 +415,2 @@ case 'Int8Array': | ||
*/ | ||
function objectEqual(leftHandOperand, rightHandOperand, options) { | ||
@@ -417,0 +417,0 @@ var leftHandKeys = getEnumerableKeys(leftHandOperand); |
@@ -87,5 +87,5 @@ { | ||
"engines": { | ||
"node": ">=0.12" | ||
"node": ">=6" | ||
}, | ||
"version": "3.0.1" | ||
"version": "4.0.0" | ||
} |
@@ -111,7 +111,11 @@ <h1 align=center> | ||
- `eql(Object.create({ foo: { a: 1 } }), Object.create({ foo: { a: 2 } })).should.be.false;` | ||
- When comparing `Error` objects, only `name`, `message`, and `code` properties are considered, regardless of enumerability: | ||
- `eql(Error('foo'), Error('foo')).should.be.true;` | ||
- `eql(Error('foo'), Error('bar')).should.be.false;` | ||
- `eql(Error('foo'), TypeError('foo')).should.be.false;` | ||
- `eql(Object.assign(Error('foo'), { code: 42 }), Object.assign(Error('foo'), { code: 42 })).should.be.true;` | ||
- `eql(Object.assign(Error('foo'), { code: 42 }), Object.assign(Error('foo'), { code: 13 })).should.be.false;` | ||
- `eql(Object.assign(Error('foo'), { otherProp: 42 }), Object.assign(Error('foo'), { otherProp: 13 })).should.be.true;` | ||
- Arguments are not Arrays: | ||
- `eql([], arguments).should.be.false;` | ||
- `eql([], Array.prototype.slice.call(arguments)).should.be.true;` | ||
- Error objects are compared by reference (see https://github.com/chaijs/chai/issues/608): | ||
- `eql(new Error('msg'), new Error('msg')).should.be.false;` | ||
- `var err = new Error('msg'); eql(err, err).should.be.true;` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55302
1203
121