Skip to content

Commit 0880064

Browse files
committed
Immutable.js expects hashCode to be a function.
1 parent cf47d86 commit 0880064

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/N3DataFactory.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ export class Term {
3535
return this.id;
3636
}
3737

38-
// ### Implement hashCode for Immutable.js, since we implement `equals`
39-
// https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()
40-
get hashCode() {
41-
return 0;
42-
}
43-
4438
// ### Returns whether this object represents the same term as the other
4539
equals(other) {
4640
// If both terms were created by this library,
@@ -52,6 +46,12 @@ export class Term {
5246
this.value === other.value;
5347
}
5448

49+
// ### Implement hashCode for Immutable.js, since we implement `equals`
50+
// https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()
51+
hashCode() {
52+
return 0;
53+
}
54+
5555
// ### Returns a plain object representation of this term
5656
toJSON() {
5757
return {

test/Term-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Term', () => {
2828

2929
describe('A Term instance', () => {
3030
it('has an integer hashCode', () => {
31-
new Term().should.have.property('hashCode', 0);
31+
new Term().hashCode().should.equal(0);
3232
});
3333
});
3434

0 commit comments

Comments
 (0)