Automattic / Automattic/expect.js

Assertion for comparing objects recursively with strict equality

Open
#5 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

Examples:

```
expect({ a: 3 }).to.equalRec({ a: '3' }) // fails
expect({ a: 3 }).to.equalRec({ a: 3 }) // succeeds
```

Objects are compared by comparing the values of their properties via strict equality `===`.

Signature:

```
equalRec([recursionDepth=1], value)
```

A `recursionDepth` of 0 means: compare objects with strict equals. A `recursionDepth` > 0 means: compare the properties of objects via `equalRec(recursionDepth-1)`.

Optional: create a similar analog of `eql()` called `eqlRec()`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.