stacktracejs/stackframe

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

caub opened this issue · 1 comments

caub commented

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

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.