Skip to content

Commit

Permalink
Fix Repeat(<value>).equals(undefined) incorrectly returning true (#1994)
Browse files Browse the repository at this point in the history
* Add failing test case for Repeat(<value>).equals(undefined)

* Fix Repeat(<value>).equals(undefined) incorrectly returning true
  • Loading branch information
butchler committed May 10, 2024
1 parent d7664bf commit be3cb9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions __tests__/Repeat.ts
Expand Up @@ -11,4 +11,8 @@ describe('Repeat', () => {
expect(v.toArray()).toEqual(['wtf', 'wtf', 'wtf']);
expect(v.join()).toEqual('wtf,wtf,wtf');
});

it('does not claim to be equal to undefined', () => {
expect(Repeat(1).equals(undefined)).toEqual(false);
});
});
2 changes: 1 addition & 1 deletion src/Repeat.js
Expand Up @@ -93,7 +93,7 @@ export class Repeat extends IndexedSeq {
equals(other) {
return other instanceof Repeat
? is(this._value, other._value)
: deepEqual(other);
: deepEqual(this, other);
}
}

Expand Down

0 comments on commit be3cb9a

Please sign in to comment.