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

feat: option to not serialize functions

AndersDJohnson opened this issue · comments

+1+1+1+1

who guys made any forked version?

Found a cheap workaround for now...

const obj = { func: [Function] };
obj.func.toString = () => null;

serialize(obj); // got no exception

Feel free to open a PR for this change and we can review it.

The new option ignoreFunction is available in v2.1.0. Thanks!
https://github.com/yahoo/serialize-javascript#optionsignorefunction