Giter Site home page Giter Site logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
Fixed in new release.

Original comment by [email protected] on 16 Jul 2013 at 11:17

  • Changed state: Fixed

from jshashtable.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.