debitoor / safe-json-stringify

A wrapper for JSON.stringify that handles circular references and prevent defined getters from throwing errors.
https://www.npmjs.com/package/safe-json-stringify
56 stars 16 forks source link

Breaks with `Object.create(null)` #1

Closed jkrems closed 9 years ago

jkrems commented 9 years ago

Example: stringify(Object.create(null)).

TypeError: Object object has no method 'hasOwnProperty'
    at safeGetValueFromPropertyOnObject (/path/to/safe-json-stringify/index.js:2:10)
    at /path/to/safe-json-stringify/index.js:26:16

For reference:

> node -p 'JSON.stringify(Object.create(null))'
{}