Skip to content

Instantly share code, notes, and snippets.

@deleteman
Created March 28, 2019 02:21
Show Gist options
  • Select an option

  • Save deleteman/f171cb30d608d49de53904e1907e9ccf to your computer and use it in GitHub Desktop.

Select an option

Save deleteman/f171cb30d608d49de53904e1907e9ccf to your computer and use it in GitHub Desktop.
usong node-serialize to serialize objects
const serialize = require("node-serialize")
var obj = {
name: 'Bob',
say: function() {
return 'hi ' + this.name;
}
};
var objS = serialize.serialize(obj);
console.log(typeof objS === 'string');
console.log(objS)
console.log(serialize.unserialize(objS).say() === 'hi Bob')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment