Skip to content

Array replacer raises an error #14

Description

@gergoerdosi

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"}'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions