Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: hunterloftis/cryo
base: 3f7d7473af
...
head fork: hunterloftis/cryo
compare: 5d64f78696
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 37 additions and 7 deletions.
  1. +30 −7 README.md
  2. +7 −0 test/complex.test.js
View
37 README.md
@@ -1,14 +1,15 @@
# Cryo
-Easily freeze and re-hydrate complex JavaScript objects.
+Easily serialize and deserialize JavaScript objects.
-Built for node.js and browsers. Cryo is inspired by Python's Pickle, extending JSON to handle:
+Built for node.js and browsers. Cryo is inspired by Python's Pickle, and works similarly to JSON.stringify() and JSON.parse().
+Cryo.stringify() and Cryo.parse() handle these additional circumstances:
-- [Functions](https://github.com/hunterloftis/cryo/blob/master/test/function.test.js)
-- [Undefined](https://github.com/hunterloftis/cryo/blob/master/test/null.test.js)
-- [Dates](https://github.com/hunterloftis/cryo/blob/master/test/date.test.js)
-- [Nested references](https://github.com/hunterloftis/cryo/blob/master/test/complex.test.js)
-- [Infinity](https://github.com/hunterloftis/cryo/blob/master/test/number.test.js)
+- [Undefined](#undefined)
+- [Date](#date)
+- [Infinity](#infinity)
+- [Object references](#references)
+- [Functions](#functions)
## Installation
@@ -44,6 +45,28 @@ var hydrated = Cryo.parse(frozen);
hydrated.hello(); // Hunter says hello!
```
+## A more powerful JSON.stringify() and JSON.parse()
+
+### Undefined
+
+- [Undefined tests](https://github.com/hunterloftis/cryo/blob/master/test/null.test.js)
+
+### Date
+
+- [Date tests](https://github.com/hunterloftis/cryo/blob/master/test/date.test.js)
+
+### References
+
+- [Object reference tests](https://github.com/hunterloftis/cryo/blob/master/test/complex.test.js)
+
+### Infinity
+
+- [Infinity tests](https://github.com/hunterloftis/cryo/blob/master/test/number.test.js)
+
+### Functions
+
+- [Function tests](https://github.com/hunterloftis/cryo/blob/master/test/function.test.js)
+
## Tests
Tests require node.js.
View
7 test/complex.test.js
@@ -54,4 +54,11 @@ describe('Complex', function() {
assert.strictEqual(hydrated.activeUser, hydrated.sortedUsers[0]);
});
+ it('should be able to hydrate itself', function() {
+ var stringified = Cryo.stringify(Cryo);
+ var hydrated = Cryo.parse(stringified);
+
+ assert.isFunction(hydrated.parse);
+ assert.isFunction(hydrated.stringify);
+ });
});

No commit comments for this range

Something went wrong with that request. Please try again.