simple-update-in
Advanced tools
Comparing version 2.1.1-master.8661c10 to 2.1.1-master.99f56bd
@@ -8,2 +8,5 @@ # Changelog | ||
## [Unreleased] | ||
### Changed | ||
- Fix [#24](https://github.com/compulim/simple-update-in/issues/24), polyfill `Object.is` for IE11, in PR [#25](https://github.com/compulim/simple-update-in/pull/25) | ||
- Polyfill code is adopted from [`core-js`](https://npmjs.com/package/core-js) to maintain zero dependency | ||
@@ -10,0 +13,0 @@ ## [2.1.0] - 2019-07-18 |
@@ -138,2 +138,6 @@ (function (global, factory) { | ||
var objectIs = Object.is || function (x, y) { | ||
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; | ||
}; | ||
function simpleUpdateIn(obj, path, updater) { | ||
@@ -503,3 +507,3 @@ validatePath(path); | ||
} else { | ||
if (Object.is(nextValue, value)) { | ||
if (objectIs(nextValue, value)) { | ||
return obj; | ||
@@ -528,3 +532,3 @@ } else { | ||
} else { | ||
if (Object.is(_nextValue, value)) { | ||
if (objectIs(_nextValue, value)) { | ||
return obj; | ||
@@ -531,0 +535,0 @@ } else { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).simpleUpdateIn=e()}(this,function(){"use strict";function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function t(c){return function(){var t=this,i=arguments;return new Promise(function(e,r){var n=c.apply(t,i);function o(t){u(n,e,r,o,a,"next",t)}function a(t){u(n,e,r,o,a,"throw",t)}o(void 0)})}}function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(r,!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function b(t){return function(t){if(Array.isArray(t))return t}(t)||e(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function v(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||e(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function e(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function r(t,e,r){d(e);var n=function t(e,r){if(!r.length)return;var n=b(r),o=n[0],a=n.slice(1);if("function"==typeof o){var i=[];if(Array.isArray(e))for(var c=0,u=e.length;c<u;c++)o.call(e,e[c],c)&&i.push.apply(i,v(t(e,[c].concat(v(a)))));else for(var f in e||{})o.call(e,e[f],f)&&i.push.apply(i,v(t(e,[f].concat(v(a)))));return i}var s=t(void 0!==e&&e[o],a);return s?s.map(function(t){return[o].concat(v(t))}):[[o]]}(t,e),o=!0,a=!1,i=void 0;try{for(var c,u=n[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var f=c.value;t=g(t,f,r?r(x(t,f)):void 0)}}catch(t){a=!0,i=t}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}return t}function o(){return(o=t(regeneratorRuntime.mark(function t(e,r,n){var o,a,i,c,u,f,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return d(r),t.next=3,m(e,r);case 3:o=t.sent,i=!(a=!0),c=void 0,t.prev=7,u=o[Symbol.iterator]();case 9:if(a=(f=u.next()).done){t.next=26;break}if(s=f.value,t.t0=g,t.t1=e,t.t2=s,n)return t.next=17,n(x(e,s));t.next=20;break;case 17:t.t3=t.sent,t.next=21;break;case 20:t.t3=void 0;case 21:t.t4=t.t3,e=(0,t.t0)(t.t1,t.t2,t.t4);case 23:a=!0,t.next=9;break;case 26:t.next=32;break;case 28:t.prev=28,t.t5=t.catch(7),i=!0,c=t.t5;case 32:t.prev=32,t.prev=33,a||null==u.return||u.return();case 35:if(t.prev=35,i)throw c;t.next=38;break;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.abrupt("return",e);case 41:case"end":return t.stop()}},t,null,[[7,28,32,40],[33,,35,39]])}))).apply(this,arguments)}function d(t){if(!Array.isArray(t))throw new Error("path must be an array")}r.updateInAsync=function(t,e,r){return o.apply(this,arguments)};var h=["__proto__","constructor","prototype"];function m(t,e){return a.apply(this,arguments)}function a(){return(a=t(regeneratorRuntime.mark(function t(e,r){var n,o,a,i,c,u,f,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r.length){t.next=2;break}return t.abrupt("return");case 2:if(n=b(r),o=n[0],a=n.slice(1),"function"!=typeof o){t.next=43;break}if(i=[],!Array.isArray(e)){t.next=25;break}c=0,u=e.length;case 7:if(c<u)return t.next=10,o.call(e,e[c],c);t.next=23;break;case 10:if(t.t0=t.sent,t.t0)return t.t1=i.push,t.t2=i,t.t3=v,t.next=17,m(e,[c].concat(v(a)));t.next=20;break;case 17:t.t4=t.sent,t.t5=(0,t.t3)(t.t4),t.t1.apply.call(t.t1,t.t2,t.t5);case 20:c++,t.next=7;break;case 23:t.next=42;break;case 25:t.t6=regeneratorRuntime.keys(e||{});case 26:if((t.t7=t.t6()).done){t.next=42;break}return f=t.t7.value,t.next=30,o.call(e,e[f],f);case 30:if(t.t8=t.sent,t.t8)return t.t9=i.push,t.t10=i,t.t11=v,t.next=37,m(e,[f].concat(v(a)));t.next=40;break;case 37:t.t12=t.sent,t.t13=(0,t.t11)(t.t12),t.t9.apply.call(t.t9,t.t10,t.t13);case 40:t.next=26;break;case 42:return t.abrupt("return",i);case 43:return t.next=45,m(void 0!==e&&e[o],a);case 45:return s=t.sent,t.abrupt("return",s?s.map(function(t){return[o].concat(v(t))}):[[o]]);case 47:case"end":return t.stop()}},t)}))).apply(this,arguments)}function x(t,e){return e.reduce(function(t,e){return t&&t[e]},t)}function g(t,e,r){if(!e.length)return r;var n,o=b(e),a=o[0],i=o.slice(1),c=void 0!==t&&t[a],u=t;if(n=a,h.includes(n))return t;if("string"!=typeof a||"object"===p(u)&&!Array.isArray(u)?"number"!=typeof a||Array.isArray(u)||(u=[]):u={},"number"==typeof a){var f=g(c,i,r);return void 0===f?void 0===t?t:(a in u&&(u=v(u)).splice(a,1),u):Object.is(f,c)?t:((u=v(u))[a]=f,u)}var s=g(c,i,r);return void 0===s?void 0===t?t:(a in u&&delete(u=y({},u))[a],u):Object.is(s,c)?t:y({},u,l({},a,s))}return r}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).simpleUpdateIn=e()}(this,function(){"use strict";function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function t(u){return function(){var t=this,i=arguments;return new Promise(function(e,r){var n=u.apply(t,i);function o(t){c(n,e,r,o,a,"next",t)}function a(t){c(n,e,r,o,a,"throw",t)}o(void 0)})}}function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(r,!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function b(t){return function(t){if(Array.isArray(t))return t}(t)||e(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function v(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||e(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function e(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}var d=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};function r(t,e,r){h(e);var n=function t(e,r){if(!r.length)return;var n=b(r),o=n[0],a=n.slice(1);if("function"==typeof o){var i=[];if(Array.isArray(e))for(var u=0,c=e.length;u<c;u++)o.call(e,e[u],u)&&i.push.apply(i,v(t(e,[u].concat(v(a)))));else for(var f in e||{})o.call(e,e[f],f)&&i.push.apply(i,v(t(e,[f].concat(v(a)))));return i}var s=t(void 0!==e&&e[o],a);return s?s.map(function(t){return[o].concat(v(t))}):[[o]]}(t,e),o=!0,a=!1,i=void 0;try{for(var u,c=n[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var f=u.value;t=w(t,f,r?r(g(t,f)):void 0)}}catch(t){a=!0,i=t}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}return t}function o(){return(o=t(regeneratorRuntime.mark(function t(e,r,n){var o,a,i,u,c,f,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h(r),t.next=3,x(e,r);case 3:o=t.sent,i=!(a=!0),u=void 0,t.prev=7,c=o[Symbol.iterator]();case 9:if(a=(f=c.next()).done){t.next=26;break}if(s=f.value,t.t0=w,t.t1=e,t.t2=s,n)return t.next=17,n(g(e,s));t.next=20;break;case 17:t.t3=t.sent,t.next=21;break;case 20:t.t3=void 0;case 21:t.t4=t.t3,e=(0,t.t0)(t.t1,t.t2,t.t4);case 23:a=!0,t.next=9;break;case 26:t.next=32;break;case 28:t.prev=28,t.t5=t.catch(7),i=!0,u=t.t5;case 32:t.prev=32,t.prev=33,a||null==c.return||c.return();case 35:if(t.prev=35,i)throw u;t.next=38;break;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.abrupt("return",e);case 41:case"end":return t.stop()}},t,null,[[7,28,32,40],[33,,35,39]])}))).apply(this,arguments)}function h(t){if(!Array.isArray(t))throw new Error("path must be an array")}r.updateInAsync=function(t,e,r){return o.apply(this,arguments)};var m=["__proto__","constructor","prototype"];function x(t,e){return a.apply(this,arguments)}function a(){return(a=t(regeneratorRuntime.mark(function t(e,r){var n,o,a,i,u,c,f,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r.length){t.next=2;break}return t.abrupt("return");case 2:if(n=b(r),o=n[0],a=n.slice(1),"function"!=typeof o){t.next=43;break}if(i=[],!Array.isArray(e)){t.next=25;break}u=0,c=e.length;case 7:if(u<c)return t.next=10,o.call(e,e[u],u);t.next=23;break;case 10:if(t.t0=t.sent,t.t0)return t.t1=i.push,t.t2=i,t.t3=v,t.next=17,x(e,[u].concat(v(a)));t.next=20;break;case 17:t.t4=t.sent,t.t5=(0,t.t3)(t.t4),t.t1.apply.call(t.t1,t.t2,t.t5);case 20:u++,t.next=7;break;case 23:t.next=42;break;case 25:t.t6=regeneratorRuntime.keys(e||{});case 26:if((t.t7=t.t6()).done){t.next=42;break}return f=t.t7.value,t.next=30,o.call(e,e[f],f);case 30:if(t.t8=t.sent,t.t8)return t.t9=i.push,t.t10=i,t.t11=v,t.next=37,x(e,[f].concat(v(a)));t.next=40;break;case 37:t.t12=t.sent,t.t13=(0,t.t11)(t.t12),t.t9.apply.call(t.t9,t.t10,t.t13);case 40:t.next=26;break;case 42:return t.abrupt("return",i);case 43:return t.next=45,x(void 0!==e&&e[o],a);case 45:return s=t.sent,t.abrupt("return",s?s.map(function(t){return[o].concat(v(t))}):[[o]]);case 47:case"end":return t.stop()}},t)}))).apply(this,arguments)}function g(t,e){return e.reduce(function(t,e){return t&&t[e]},t)}function w(t,e,r){if(!e.length)return r;var n,o=b(e),a=o[0],i=o.slice(1),u=void 0!==t&&t[a],c=t;if(n=a,m.includes(n))return t;if("string"!=typeof a||"object"===p(c)&&!Array.isArray(c)?"number"!=typeof a||Array.isArray(c)||(c=[]):c={},"number"==typeof a){var f=w(u,i,r);return void 0===f?void 0===t?t:(a in c&&(c=v(c)).splice(a,1),c):d(f,u)?t:((c=v(c))[a]=f,c)}var s=w(u,i,r);return void 0===s?void 0===t?t:(a in c&&delete(c=y({},c))[a],c):d(s,u)?t:y({},c,l({},a,s))}return r}); |
@@ -8,2 +8,6 @@ "use strict"; | ||
var _objectIs = _interopRequireDefault(require("./objectIs")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -399,3 +403,3 @@ | ||
} else { | ||
if (Object.is(nextValue, value)) { | ||
if ((0, _objectIs["default"])(nextValue, value)) { | ||
return obj; | ||
@@ -424,3 +428,3 @@ } else { | ||
} else { | ||
if (Object.is(_nextValue, value)) { | ||
if ((0, _objectIs["default"])(_nextValue, value)) { | ||
return obj; | ||
@@ -427,0 +431,0 @@ } else { |
{ | ||
"name": "simple-update-in", | ||
"version": "2.1.1-master.8661c10", | ||
"version": "2.1.1-master.99f56bd", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "browser": "dist/simple-update-in.production.min.js", |
@@ -52,2 +52,4 @@ # simple-update-in | ||
> Polyfill for `Object.is` is adopted from [`core-js`](https://npmjs.com/package/core-js) to maintain zero dependency. | ||
### Browser only | ||
@@ -54,0 +56,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50659
8
812
280