Please see this page.
MIT, see LICENSE.
Improved Javascript Serialization for objects
Home Page: http://nanodeath.github.io/HydrateJS/
License: MIT License
Please see this page.
MIT, see LICENSE.
When hydrate is installed with npm install hydrate
it doesn't call the compile-dev.sh
script automatically. It is needed to be run by hand.
It was tested under ubuntu 14.04
Hydrate.prototype.analyze
does not have a case to handle input == null
(type coercion intended), causing it to fail with a TypeError
when goes into the default case.
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.
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.
var obj = { show: function() {
console.log('ok');
}};
// error: Couldn't serialize object; had non-prototype function
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.
If you add undefined
to the list of primitives, the "should serialize primitives" test fails:
it("should serialize primitives", function() {
var inputs = [undefined, 3, "foo", ["a", 3, "bar"]]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.