Giter Club home page Giter Club logo

hydratejs's Introduction

HydrateJS Build Status

Please see this page.

License

MIT, see LICENSE.

hydratejs's People

Contributors

ashishmadeti avatar freethenation avatar nanodeath avatar olegabr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hydratejs's Issues

NPM package?

I have been playing around with HydrateJS and it seems to work pretty well. Is there any reason why HydrateJS is not available via NPM? I would be glad to submit a patch with a package file and a cake file (would then be buildable on windows then without cygwin) if that is the only reason its not on NPM.

Booleans don't serialize and deserialize properly

var h = new Hydrate();
h.parse(h.stringify([false]))[0];   // {"__h_cons":"Boolean"}
h.parse(h.stringify([true]))[0];    // {"__h_cons":"Boolean"}
h.parse(h.stringify({f: false})).f; // {}
h.parse(h.stringify(false));        // {}

// TypeError: Boolean.prototype.valueOf is not generic
h.parse(h.stringify(false)).valueOf();

The primitive value never seems to re-emerge and the Booleans produced are broken.

NonPrototypeFunctionError

var obj = { show: function() {
console.log('ok');
}};

// error: Couldn't serialize object; had non-prototype function

De-serialized object prototype properties become enumerable on the object itself

Tested in both Chrome and Firefox:

function Foo() {}
Foo.prototype.toString = function() { return "Foo"; };

foo = new Foo();
foo.hasOwnProperty('toString'); // => false

var hydrate = new Hydrate();
foo = hydrate.parse(hydrate.stringify(new Foo()));

foo.hasOwnProperty('toString'); // => true

As a result of this I can't re-serialize the object because it now has properties with functions and, on longer prototype chains, it also has an enumerable constructor property.

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.