yahoo / serialize-javascript

Serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for instances of classes

nicojs opened this issue · comments

I am working on an implementation for supporting instances of classes. For example:

class Person {
  constructor(name, parent) {
    this.name = name;
    this.parent = parent;
  }
}

serialize(new Person('foo', new Person('bar', null)); 
// => 'new Person("foo", new Person("bar", null))'

Would you guys be interested in this kind of functionality?

If anyone needs this functionality: I've created surrial. It is a similar library, but with class instance support