Can be used from node or the browser.
This package is intended for freezing and thawing simple objects and arrays. In order to clone arrays properly is invokes objects' prototypes constructor in order to make copies, so it probably won't work with objects with complex custom constructors or properties that aren't carefully designed to work with it.
Freeze your pizza
var pizza ="toppings":"name": "Broccoli""name": "Onions"pizzatoppings;// The second parameter, 'true', means 'allow freezing in-place'.// i.e. we don't care about keeping the original object mutable.var frozenPizza = DeepFreezer;frozenPizzatoppings; // an error! Pizza's frozenpizzatoppings; // Also an error! That's the same instance as frozenPizza.var thawedPizza = DeepFreezer;thawedPizzatoppings; // That's okay!thawedPizzatoppings1name = "Extra sauce"; // An error! The toppings were also each frozen.var totallyThawedPizza = DeepFreezer;thawedPizzatoppings1name = "Extra sauce"; // Ahh there we go.pizzatoppings1name; // Still "Onions"
See test.html and test.js for more examples.