flitbit / json-ptr

A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.
MIT License
91 stars 28 forks source link

ES2015-specific code was causing errors #8

Closed frankrue closed 6 years ago

frankrue commented 7 years ago

This merge would remove ES2015-specific code, which was causing iOS Safari to error on the use of the "use strict" command with let keywords and the ()=> form of a function definition.

nihaux commented 6 years ago

@flitbit would it be possible to merge this ? It is causing uglifyJS to throw an error during uglification as it only supports pure es5.

sbusch commented 6 years ago

yarn run build for a project based on create-react-app fails due to the same reason, I suppose:

yarn run v1.3.2
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

    ./node_modules/json-ptr/index.js:208

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sbusch commented 6 years ago

As an alternative to this PR, fork of @danfo contains a possible solution in the build-es5-lib branch, see commit https://github.com/danfo/json-ptr/commit/33b5c09bfb21c74c59e5c514162fd0b224a46600

Edit: PR is incomplete because ES2015-keywords like class are still there. Instead of manually converting all ES2015-specific code (and then being restricted to the old syntax) I would prefer solution of @danfo.

flitbit commented 6 years ago

I'm pretty sure this is no longer an issue; I've gone back to ES5 by default since there wasn't enough reasons for the compatibility hassles of ES6+ in such a small module. Let me know.