Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array replacer raises an error #14

Open
gergoerdosi opened this issue Sep 13, 2015 · 2 comments
Open

Array replacer raises an error #14

gergoerdosi opened this issue Sep 13, 2015 · 2 comments

Comments

@gergoerdosi
Copy link

The documentations says:

The first three arguments are the same as to JSON.stringify.

But when I try to pass an array of strings as the second parameter, the module raises an error:

> var object = { a: 'b', c: 'd' }
undefined
> stringify(object, ['a'])
TypeError: undefined is not a function
    at Object.<anonymous> (/node_modules/json-stringify-safe/stringify.js:25:48)
    at Object.stringify (native)
    at stringify (/node_modules/json-stringify-safe/stringify.js:5:15)
    at repl:1:11
    at REPLServer.defaultEval (repl.js:132:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)

The same argument works with JSON.stringify:

> JSON.stringify(object, ['a'])
'{"a":"b"}'
@moll
Copy link
Owner

moll commented Sep 13, 2015

Hey! Thanks for the report. You're right. That slipped through. Will fix it. ;-)

Marsup added a commit to Marsup/json-stringify-safe that referenced this issue Sep 13, 2015
@paulsmithkc
Copy link

Incorporated into forked package https://www.npmjs.com/package/@merlin4/json-stringify-safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants