Skip to content

Commit 3024af7

Browse files
committed
Optimize a bit, test more, and document more
1 parent d705469 commit 3024af7

9 files changed

Lines changed: 1200 additions & 859 deletions

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ But in many real-world scenarios (API responses, optional fields, configuration
1919

2020
- 🚀 **Fast** - Optimized for performance with early exits and minimal overhead
2121
- 🎯 **Loose equality** - Missing properties are treated as `undefined`
22-
- 🛡️ **Safe** - Handles circular references, null prototypes, and edge cases
2322
- 📦 **Zero dependencies** - Small and self-contained
2423
- 🔧 **Drop-in replacement** - Compatible with other deep equality functions
2524
- 🆕 **ES6+ Support** - Full support for Maps, Sets, TypedArrays, and BigInt
@@ -139,12 +138,19 @@ The algorithm:
139138

140139
## Edge cases handled
141140

142-
- ✅ Circular references (throws like other deep equal libraries)
143141
- ✅ Objects with null prototype
144142
- ✅ Objects with overridden `hasOwnProperty`
145-
- ✅ Sparse arrays
143+
- ✅ Sparse arrays (holes treated as `undefined`)
146144
- ✅ Symbol properties (ignored, like other libraries)
147145
- ✅ Non-enumerable properties (ignored)
146+
- ⚠️ Arrays with extra properties: Only numeric indices are compared, extra properties are ignored. This matches `fast-deep-equal` behavior.
147+
```js
148+
const arr1 = [1, 2, 3];
149+
arr1.customProp = 'value1';
150+
const arr2 = [1, 2, 3];
151+
arr2.customProp = 'value2';
152+
looseEqual(arr1, arr2); // true - extra properties ignored
153+
```
148154

149155
## API
150156

0 commit comments

Comments
 (0)