Skip to content

Commit be3cb9a

Browse files
authored
Fix Repeat(<value>).equals(undefined) incorrectly returning true (#1994)
* Add failing test case for Repeat(<value>).equals(undefined) * Fix Repeat(<value>).equals(undefined) incorrectly returning true
1 parent d7664bf commit be3cb9a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

__tests__/Repeat.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ describe('Repeat', () => {
1111
expect(v.toArray()).toEqual(['wtf', 'wtf', 'wtf']);
1212
expect(v.join()).toEqual('wtf,wtf,wtf');
1313
});
14+
15+
it('does not claim to be equal to undefined', () => {
16+
expect(Repeat(1).equals(undefined)).toEqual(false);
17+
});
1418
});

src/Repeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Repeat extends IndexedSeq {
9393
equals(other) {
9494
return other instanceof Repeat
9595
? is(this._value, other._value)
96-
: deepEqual(other);
96+
: deepEqual(this, other);
9797
}
9898
}
9999

0 commit comments

Comments
 (0)