Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
assert: remove and improve a few comments
  • Loading branch information
BridgeAR committed Jul 26, 2017
commit b5156242501531028f183d999197b9b709fcfa36
8 changes: 1 addition & 7 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ function setEquiv(a, b, strict, memo) {
// This is a lazily initiated Set of entries which have to be compared
// pairwise.
var set = null;
// When the sets contain only value types (eg, lots of numbers), and we're in
// strict mode or if all entries strictly match, we don't need to match the
// entries in a pairwise way. In that case this initialization is done lazily
// to avoid the allocation & bookkeeping cost.
for (const val of a) {
// Note: Checking for the objects first improves the performance for object
// heavy sets but it is a minor slow down for primitives. As they are fast
Expand All @@ -377,7 +373,7 @@ function setEquiv(a, b, strict, memo) {

if (set !== null) {
for (const val of b) {
// In non-strict-mode we have to check if a primitive value is already
// We have to check if a primitive value is already
// matching and only if it's not, go hunting for it.
if (typeof val === 'object' && val !== null) {
if (!setHasEqualElement(set, val, strict, memo))
Expand Down Expand Up @@ -479,8 +475,6 @@ function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
}

function mapEquiv(a, b, strict, memo) {
// Caveat: In non-strict mode, this implementation does not handle cases
// where maps contain two equivalent-but-not-reference-equal keys.
if (a.size !== b.size)
return false;

Expand Down