console-feed
console-feed copied to clipboard
Code breaks for objects created with Object.create(null)
When an object is created using Object.create(null) it does not contain properties that are inherited from Object for example hasOwnProperty
or __proto__
Inside EncodingTransformer.prototype._handlePlainObject
this causes an issue where in we depend on hasOwnProperty
and also on __proto__
.
https://github.com/samdenty/console-feed/blob/master/src/Transform/replicator/index.ts#L98
This becomes an issue when someone is using query-string
npm package
https://www.npmjs.com/package/query-string
This packages parse
method creates a parsed object with Object.create(null);
I think we will have to place in a check for the existence of these properties on an object and only then handle them correctly.
@samdenty If it's alright then I would like to pick up this issue and propose a solution around the same.
replicator/index.ts
is forked from https://www.npmjs.com/package/replicator, probably best to send a pr there and merge back
Understood. Thank you @samdenty . I will send a PR on replicator.
Created a PR to fix the same. https://github.com/inikulin/replicator/pull/5