Skip to content

diff of equal objects should return empty array #63

@royaldark

Description

@royaldark

Why does diff({}, {a: 4}) return an array of differences, but diff({}, {}) return undefined? I would expect it to return [] instead.

This makes iteration over the changes much easier. No check for undefined is needed.

We also occasionally use diff only to count the number of differences. This means code like diff(a, b).length will break on equal objects.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions