react-json-tree
react-json-tree copied to clipboard
Replaced ES6 instance methods with static one
What is done in this PR
- Replaced ES6 insance methods
Array.prototype.findwithArray.findasbabel-plugin-transform-runtimedoes not polyfill them in such a way (see why and also see readme from core-js, without global scope pollution). - Updated
sortObjectKeyshandling according to MDN
Currently react-json-tree doesn't work on IE and Edge 11, see MDN
@alexkuz please consider this changes.
Thank you! But I'd just use a polyfill actually
import 'core-js/fn/array/find';
importing this will pollute global scope by modifying Array.prototype directly. But since you are using transform-runtime (and I think this is the right way) the es6 instance method should be written in static way.
Please @alexkuz consider my answer, I want to use your lib badly, but I have to support IE9+ )
And I would also include fix for this issue in this PR

~~Can you give a hint, what you are waiting sortObjectKeys should be?~~
Bad question. Description is on the README. So I'll just update this file too
I think the best solution here would be not using find at all, I'll get rid of it in the next version. For now, if you're using it in an app, just add a polyfill.
(Array.find doesn't seem to me like an appropriate solution, it's not in specs so technically this code is not valid)
It would be great to get the sortObjectKeys change merged in, at least. The component breaks when sortObjectTrees is simply set to true.
Hi, can this PR be merged/released?