diff --git a/.travis.yml b/.travis.yml index e6379b6..842103e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ dist: trusty language: node_js node_js: - - "8" - "10" - "12" - "13" diff --git a/index.js b/index.js index 2f03bfb..7316ef4 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,11 @@ 'use strict'; -/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */ +/* global Map:readonly, WeakMap:readonly, Set:readonly, WeakSet:readonly, ArrayBuffer:readonly */ var hasElementType = typeof Element !== 'undefined'; var hasMap = typeof Map === 'function'; +var hasWeakMap = typeof WeakMap === 'function'; var hasSet = typeof Set === 'function'; +var hasWeakSet = typeof WeakSet === 'function'; var hasArrayBuffer = typeof ArrayBuffer === 'function'; // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js @@ -45,7 +47,8 @@ function equal(a, b) { // // **Note**: `i` access switches to `i.value`. var it; - if (hasMap && (a instanceof Map) && (b instanceof Map)) { + if ((hasMap && (a instanceof Map) && (b instanceof Map)) || + (hasWeakMap && (a instanceof WeakMap) && (b instanceof WeakMap))) { if (a.size !== b.size) return false; it = a.entries(); for (i = it.next(); !i.done; i = it.next()) @@ -56,14 +59,14 @@ function equal(a, b) { return true; } - if (hasSet && (a instanceof Set) && (b instanceof Set)) { + if (hasSet && (a instanceof Set) && (b instanceof Set) || + (hasWeakSet && (a instanceof WeakSet) && (b instanceof WeakSet))) { if (a.size !== b.size) return false; it = a.entries(); for (i = it.next(); !i.done; i = it.next()) if (!b.has(i.value[0])) return false; return true; } - // END: Modifications if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; @@ -72,6 +75,7 @@ function equal(a, b) { if (a[i] !== b[i]) return false; return true; } + // END: Modifications if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); diff --git a/test/browser/index.js b/test/browser/index.js index e89263a..4992849 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -4,6 +4,7 @@ require('core-js/features/map'); require('core-js/features/set'); require('core-js/features/weak-map'); +require('core-js/features/weak-set'); require('core-js/features/symbol'); require('core-js/features/regexp/flags');