Sets plus JSON

David Bruant bruant.d at gmail.com
Wed Oct 3 11:29:33 PDT 2012


Le 03/10/2012 18:37, Nicholas C. Zakas a écrit :
> (...)
>
> Set.prototype.toJSON = function() {
>     return Array.from(this);
> };
>
> That way, JSON.stringify() would do something rational by default when
> used with sets.
>
> Thoughts?
Useful defaults. I love it!

David


More information about the es-discuss mailing list