Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 702065 Details for
Bug 915082
nodejs-deep-equal has forked copy of the deepEqual function from Node's assert.js
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Difference between Node's deepEqual and nodejs-deep-equal's deepEqual
deep-equal.diff (text/plain), 2.81 KB, created by
Jamie Nguyen
on 2013-02-24 17:01:14 UTC
(
hide
)
Description:
Difference between Node's deepEqual and nodejs-deep-equal's deepEqual
Filename:
MIME Type:
Creator:
Jamie Nguyen
Created:
2013-02-24 17:01:14 UTC
Size:
2.81 KB
patch
obsolete
>--- index.js >+++ index.js >@@ -1,40 +1,27 @@ > var pSlice = Array.prototype.slice; >+var Object_keys = typeof Object.keys === 'function' >+ ? Object.keys >+ : function (obj) { >+ var keys = []; >+ for (var key in obj) keys.push(key); >+ return keys; >+ } >+; > >-function _deepEqual(actual, expected) { >+var deepEqual = module.exports = function (actual, expected) { > // 7.1. All identical values are equivalent, as determined by ===. > if (actual === expected) { > return true; > >- } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { >- if (actual.length != expected.length) return false; >- >- for (var i = 0; i < actual.length; i++) { >- if (actual[i] !== expected[i]) return false; >- } >- >- return true; >- >- // 7.2. If the expected value is a Date object, the actual value is >- // equivalent if it is also a Date object that refers to the same time. > } else if (actual instanceof Date && expected instanceof Date) { > return actual.getTime() === expected.getTime(); > >- // 7.3 If the expected value is a RegExp object, the actual value is >- // equivalent if it is also a RegExp object with the same source and >- // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). >- } else if (actual instanceof RegExp && expected instanceof RegExp) { >- return actual.source === expected.source && >- actual.global === expected.global && >- actual.multiline === expected.multiline && >- actual.lastIndex === expected.lastIndex && >- actual.ignoreCase === expected.ignoreCase; >- >- // 7.4. Other pairs that do not both pass typeof value == 'object', >+ // 7.3. Other pairs that do not both pass typeof value == 'object', > // equivalence is determined by ==. > } else if (typeof actual != 'object' && typeof expected != 'object') { > return actual == expected; > >- // 7.5 For all other Object pairs, including Array objects, equivalence is >+ // 7.4. For all other Object pairs, including Array objects, equivalence is > // determined by having the same number of owned properties (as verified > // with Object.prototype.hasOwnProperty.call), the same set of keys > // (although not necessarily the same order), equivalent values for every >@@ -66,11 +53,11 @@ > } > a = pSlice.call(a); > b = pSlice.call(b); >- return _deepEqual(a, b); >+ return deepEqual(a, b); > } > try { >- var ka = Object.keys(a), >- kb = Object.keys(b), >+ var ka = Object_keys(a), >+ kb = Object_keys(b), > key, i; > } catch (e) {//happens when one is a string literal and the other isn't > return false; >@@ -91,7 +78,7 @@ > //~~~possibly expensive deep test > for (i = ka.length - 1; i >= 0; i--) { > key = ka[i]; >- if (!_deepEqual(a[key], b[key])) return false; >+ if (!deepEqual(a[key], b[key])) return false; > } > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 915082
: 702065