Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hydux-mutator

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydux-mutator - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

dist/hydux.mutator.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mutator=t():(e.hydux=e.hydux||{},e.hydux.mutator=t())}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function r(e){void 0===e&&(e=50),a=new c.default({maxSize:e})}function i(e){var t=e.toString(),n=a.get(t);if(n)return n;var r=t.match(f);if(!r)throw new Error("Invalid setter:"+t);var i=r[1],o=0;n=[];for(var u=function(e){return e&&n.push(e)},s=0;s<i.length;s++){var c=i[s];"."===c?(u(i.slice(o,s)),o=s+1):"["===c?(u(i.slice(o,s)),o=d(i[s+1])?s+2:s+1):"]"===c&&(u(d(i[s-1])?i.slice(o,s-1):i.slice(o,s)),o=s+1)}return u(i.slice(o)),a.set(t,n),n}function o(e,t,n,r){var o="function"==typeof t?i(t):t,u=new e.constructor;c.assign(u,e);for(var s=u,a=e,f=0;f<o.length-1;f++){var d=o[f];a=a[d],s=s[d]=new a.constructor,c.assign(s,a)}var l=o[o.length-1];return s[l]=n===h.updateIn?r(a[l]):r,u}function u(e,t,n){return n?o(e,t,h.setIn,n):e}function s(e,t,n){return n?o(e,t,h.updateIn,n):e}Object.defineProperty(t,"__esModule",{value:!0});var c=n(1),a=new c.default({maxSize:50}),f=/(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|$)/;t.setCacheSize=r;var h,d=function(e){return'"'===e||"'"===e};!function(e){e[e.setIn=1]="setIn",e[e.updateIn=2]="updateIn"}(h||(h={})),t.setIn=u,t.updateIn=s,t.default={setIn:u,updateIn:s}},function(e,t,n){"use strict";function r(e,t){for(var n in t)e[n]=t[n];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=r;var i=function(){function e(e){if(this.maxSize=0,this.cache={},this.oldCache={},this._size=0,e=r({},e),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize}return e.prototype._set=function(e,t){this.cache[e]=t,++this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache={})},e.prototype.get=function(e){if(void 0!==this.cache[e])return this.cache[e];if(void 0!==this.oldCache[e]){var t=this.oldCache[e];return this._set(e,t),t}},e.prototype.set=function(e,t){return void 0!==this.cache[e]?this.cache[e]=t:this._set(e,t),this},e.prototype.has=function(e){return void 0!==this.cache[e]||void 0!==this.oldCache[e]},e.prototype.delete=function(e){delete this.cache[e]&&this._size--,delete this.oldCache[e]},e}();t.default=i}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mutator=t():(e.hydux=e.hydux||{},e.hydux.mutator=t())}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function r(e){void 0===e&&(e=50),a=new c.default({maxSize:e})}function i(e){var t=e.toString(),n=a.get(t);if(n)return n;var r=t.match(f);if(!r)throw new Error("Invalid setter:"+t);var i=r[1],o=0;n=[];for(var u=function(e){return e&&n.push(e)},s=0;s<i.length;s++){var c=i[s];"."===c?(u(i.slice(o,s)),o=s+1):"["===c?(u(i.slice(o,s)),o=d(i[s+1])?s+2:s+1):"]"===c&&(u(d(i[s-1])?i.slice(o,s-1):i.slice(o,s)),o=s+1)}return u(i.slice(o)),a.set(t,n),n}function o(e,t,n,r){var o="function"==typeof t?i(t):t,u=new e.constructor;c.assign(u,e);for(var s=u,a=e,f=0;f<o.length-1;f++){var d=o[f];a=a[d],s=s[d]=new a.constructor,c.assign(s,a)}var l=o[o.length-1];return s[l]=n===h.updateIn?r(a[l]):r,u}function u(e,t,n){return n?o(e,t,h.setIn,n):e}function s(e,t,n){return n?o(e,t,h.updateIn,n):e}Object.defineProperty(t,"__esModule",{value:!0});var c=n(1),a=new c.default({maxSize:50}),f=/(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|}|$)/;t.setCacheSize=r;var h,d=function(e){return'"'===e||"'"===e};!function(e){e[e.setIn=1]="setIn",e[e.updateIn=2]="updateIn"}(h||(h={})),t.setIn=u,t.updateIn=s,t.default={setIn:u,updateIn:s}},function(e,t,n){"use strict";function r(e,t){for(var n in t)e[n]=t[n];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=r;var i=function(){function e(e){if(this.maxSize=0,this.cache={},this.oldCache={},this._size=0,e=r({},e),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize}return e.prototype._set=function(e,t){this.cache[e]=t,++this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache={})},e.prototype.get=function(e){if(void 0!==this.cache[e])return this.cache[e];if(void 0!==this.oldCache[e]){var t=this.oldCache[e];return this._set(e,t),t}},e.prototype.set=function(e,t){return void 0!==this.cache[e]?this.cache[e]=t:this._set(e,t),this},e.prototype.has=function(e){return void 0!==this.cache[e]||void 0!==this.oldCache[e]},e.prototype.delete=function(e){delete this.cache[e]&&this._size--,delete this.oldCache[e]},e}();t.default=i}])});
//# sourceMappingURL=hydux.mutator.js.map

@@ -5,3 +5,3 @@ "use strict";

var cache = new quicklru_1.default({ maxSize: 50 });
var funRe = /(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|$)/;
var funRe = /(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|}|$)/;
function setCacheSize(maxSize) {

@@ -12,9 +12,2 @@ if (maxSize === void 0) { maxSize = 50; }

exports.setCacheSize = setCacheSize;
function getByKeys(record, keys) {
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
record = record[key];
}
return record;
}
var isQuote = function (s) { return s === '"' || s === '\''; };

@@ -21,0 +14,0 @@ function lambda2path(accessor) {

{
"name": "hydux-mutator",
"version": "0.1.3",
"version": "0.1.4",
"description": "An statically-typed immutable update helper library, built for hydux.",

@@ -22,3 +22,3 @@ "main": "./lib/index.js",

"type": "git",
"url": "git+https://github.com/hydux/hydux.git"
"url": "git+https://github.com/hydux/hydux-mutator.git"
},

@@ -33,5 +33,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/hydux/hydux/issues"
"url": "https://github.com/hydux/hydux-mutator/issues"
},
"homepage": "https://github.com/hydux/hydux#readme",
"homepage": "https://github.com/hydux/hydux-mutator#readme",
"devDependencies": {

@@ -38,0 +38,0 @@ "@types/mocha": "^2.2.44",

@@ -20,3 +20,3 @@ # hydux-mutator

[docs/media.gif]
![](https://github.com/hydux/hydux-mutator/raw/master/docs/media.gif)

@@ -71,9 +71,9 @@ ## Usage

## What's the difference of this and `monolite`
## What's the difference with `monolite`
The main difference is monolite is using es6's `Proxy<T>` under the hood, which might not support well in many browsers.
The main difference is [monolite](https://github.com/kube/monolite) is using es6's `Proxy<T>` under the hood, which might not support well in many browsers.
`hydux-mutator` is implement by parsing lambda function's source string(`fn.toString()`), this have better browser support. And the parsing part can easily be cached, which means it can have good performance.
`hydux-mutator` is implement by parsing lambda function's source string(`fn.toString()`), this have better browser support. And the parsing part can easily be cached, which means it can have better performance.
What's more, this support class state, which I merely see in other immuatble update helpers.
What's more, `hydux-mutator` support class state, which I merely see in other immuatble update helpers.

@@ -98,3 +98,3 @@ ```js

* flow has bug in checking `setIn`, see: [5569](https://github.com/facebook/flow/issues/5569)
* flow has bug in checking `setIn`, see: [#5569](https://github.com/facebook/flow/issues/5569)

@@ -101,0 +101,0 @@ ## Benchmark

import QuickLRU, { assign } from './quicklru'
let cache = new QuickLRU({ maxSize: 50 })
const funRe = /(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|$)/
const funRe = /(?:return|[\w$]+\s*\=\>)\s+[\w$]+(.*)\s*(?:;|}|$)/

@@ -9,9 +9,2 @@ export function setCacheSize(maxSize = 50) {

function getByKeys (record, keys) {
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
record = record[key]
}
return record
}
const isQuote = s => s === '"' || s === '\''

@@ -18,0 +11,0 @@ function lambda2path(accessor: Function) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc