briandipalma / esformatter-quote-props

esformatter plugin that toggles the quotes around properties.
1 stars 1 forks source link

Error if computed property key is null #3

Closed ckknight closed 8 years ago

ckknight commented 8 years ago

Input:

const data = {
  [null]: {}
};

Result:

TypeError: Cannot read property 'toString' of null
    at ensureString (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter-quote-props/index.js:17:21)
    at isSafeToUnquote (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter-quote-props/index.js:24:34)
    at Object.module.exports.nodeBefore (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter-quote-props/index.js:6:32)
    at /Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter/lib/plugins.js:83:26
    at Array.forEach (native)
    at Object.exec (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter/lib/plugins.js:81:12)
    at Object.nodeBefore (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/mout/function/partial.js:23:22)
    at transformNode (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/esformatter/lib/transform.js:60:11)
    at Array.forEach (native)
    at Object.moonwalk (/Users/ckknight/Development/SpaceViewInc/space.vu/node_modules/rocambole/rocambole.js:432:11)
briandipalma commented 8 years ago

Thanks for catching this, I've published a new major version as the code now uses ES2015 features.