stacktracejs / stackframe

JS Object representation of a stack frame.
https://www.stacktracejs.com/#!/docs/stackframe
MIT License
79 stars 16 forks source link

Bug: doesn't initialize from an object with null prototype #18

Closed caub closed 4 years ago

caub commented 5 years ago

StackFrame constructor doesn't accept object with null prototype:

> const StackFrame = require('stackframe');
undefined
> new StackFrame({fileName:'lol'})
{ fileName: 'lol' }
> new StackFrame(Object.assign(Object.create(null),{fileName:'lol'}))
{}
> new StackFrame('lol'.match(/(?<fileName>\w+)/).groups)
{}
$ npm ls stackframe
├── stackframe@1.0.4 
└─┬ stacktrace-gps@3.0.2
  └── stackframe@1.0.4  deduped
devsnek commented 5 years ago

issue is obj instanceof Object, which is... a weird way to test for objects, to say the least. it also uses obj.hasOwnProperty lower down which will cause issues when the first part is fixed.