Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)
.vscode
.idea
.history
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ResurrectJS
# [ResurrectJS](https://www.npmjs.com/package/resurrect.js)

ResurrectJS preserves object behavior (prototypes) and reference
circularity with a special JSON encoding. Unlike flat JSON, it can
Expand All @@ -9,6 +9,7 @@ also properly resurrect these types of values:
* DOM objects
* `undefined`
* NaN, Infinity, -Infinity
* Function, Class

Supported Browsers:

Expand All @@ -23,20 +24,15 @@ Read about [how it works](http://nullprogram.com/blog/2013/03/28/).
## Examples

```javascript
function Foo() {}
Foo.prototype.greet = function() { return "hello"; };

// Behavior is preserved:
function foo() {
return 1;
}
var necromancer = new Resurrect();
var json = necromancer.stringify(new Foo());
var foo = necromancer.resurrect(json);
foo.greet(); // => "hello"

// References to the same object are preserved:
json = necromancer.stringify([foo, foo]);
var array = necromancer.resurrect(json);
array[0] === array[1]; // => true
array[1].greet(); // => "hello"
array[0]() === array[1](); // => true

// Dates are restored properly
json = necromancer.stringify(new Date());
Expand Down
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "resurrect.js",
"version": "1.0.3",
"description": "ResurrectJS preserves object behavior (prototypes) and reference circularity with a special JSON encoding.",
"main": "resurrect.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lwdgit/resurrect-js.git"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should replace lwdgit with skeeto (also in two other github urls below)

},
"keywords": [
"json",
"resurrect"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/lwdgit/resurrect-js/issues"
},
"homepage": "https://github.com/lwdgit/resurrect-js#readme"
}
Loading