bruth / jsonpatch-js

A JavaScript implementation of the JSON Media Type for partial modifications: http://tools.ietf.org/html/rfc6902
http://bruth.github.io/jsonpatch-js
BSD 2-Clause "Simplified" License
181 stars 24 forks source link

Fixed UMD object assigment for Node, AMD. #29

Closed rmunson closed 7 years ago

rmunson commented 7 years ago

UMD definition was mistakenly assigning values to the root scope (window or global), asroot was being passed for AMD and Node in place of exports.

Fixed root reference for use inside webpack; The value of this does not reliably point to the window/global/module scope due to during webpacks module compilation. Modules are wrapped in a closure, so the value of this is different than the source. To make this more reliable, I've updated the root object detection to make it more expicit. root = if window? then window else if global? then global else @;

Also a minor change to stash the regex definition for matching accessors during pointer coercion.

I've bumped the version # in package.json to 0.7.0, as this seemed worth of a minor bump. That is, of course, your decision.

Hope to get this merged. I like the explicit and clear definition of your JSONPatch implementation, so I hope to use it in a webpack-based project.

Thanks.

bruth commented 7 years ago

Looks great!

rmunson commented 7 years ago

👍 Thanks!