Comments (2)
Thank you very much for this.
Re. problem 2, I'm not too worried about a poor quality hash being produced by
the default hashing function. "[object XMLDocument]" is no worse than a regular
object hashing to "[object Object]", which is what happens by default. So long
as some hash is produced without possibility of an error being thrown and it's
possible for client code to provide its own hashing mechanism, job done.
This leads onto problem 1, which is definitely a bug and needs to be dealt
with. The simplest solution is to just drop the `obj.toString();` branch in
`hashObject()`: it's redundant because your bug report proves `obj.toString();`
needs either a try/catch or lengthy special handling, and `String(obj)` will
check for and use a `toString()` method anyway.
Your `arrayToString()` is definitely useful for producing sensible hashes for
arrays but I'd prefer to keep the file size as small as possible. You can still
provide it as a hashing function in the Hashtable constructor. I've resisted
the temptation to write general purpose hashing functions for that reason,
preferring to leave sensible hashing completely up to client code.
I'll make the change and release a new version as soon as I can.
Original comment by [email protected]
on 30 Sep 2011 at 12:26
- Changed state: Accepted
from jshashtable.
Fixed in new release.
Original comment by [email protected]
on 16 Jul 2013 at 11:17
- Changed state: Fixed
from jshashtable.
Related Issues (12)
- Using an ActiveX object (such as XMLHttpRequest in IE 6) as a key gives an error HOT 1
- Can't use request object after storing It in jshashtable HOT 4
- package manager
- How can we create a deep copy of Hashtable object ?
- API function toQueryString HOT 4
- Suggestion: HashSet.add should always update/set key value, regardless of equality HOT 12
- Extern File for Closure Compiler HOT 1
- (bug report + fix) jshashset entries are not replaced when using equalityFunction HOT 6
- Complemented HOT 2
- Hashtable key array of one date HOT 2
- replaceDuplicateKey:false is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jshashtable.