Closed rorlic closed 1 year ago
I see the hashCode test always expect it to be 0:
hashCode
0
describe('A Term instance', () => { it('has an integer hashCode', () => { new Term().hashCode().should.equal(0); }); });
Why is that?
The rules for a hash code are:
So I understand that the above implementation is in fact perfectly correct, but I would not expect all of them to return the same hash :wink:
Hi @rorlic,
That's purely for Immutable.js compatibility:
https://github.com/rdfjs/N3.js/blob/b7e9a8414941f61d88db01f8ca1cb0d5205bb225/src/N3DataFactory.js#L49-L53
We don't want to require an expensive hashing library on the client.
I see the
hashCode
test always expect it to be0
:Why is that?
The rules for a hash code are:
So I understand that the above implementation is in fact perfectly correct, but I would not expect all of them to return the same hash :wink: