New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

value-enhancer

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

value-enhancer - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

dist/with-readonly-value-enhancer.d.ts

2

dist/value-enhancer.cjs.js

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

"use strict";var w=Object.defineProperty,E=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var h=(r,e,s)=>e in r?w(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,l=(r,e)=>{for(var s in e||(e={}))j.call(e,s)&&h(r,s,e[s]);if(f)for(var s of f(e))x.call(e,s)&&h(r,s,e[s]);return r},d=(r,e)=>E(r,y(e));var b=(r,e,s)=>(h(r,typeof e!="symbol"?e+"":e,s),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class C{constructor(e){b(this,"_subscribers");b(this,"_bSub");b(this,"_bSubDisposer");this._bSub=e}get size(){return this._subscribers?this._subscribers.size:0}invoke(e,s){this._subscribers&&this._subscribers.forEach(i=>i(e,s))}add(e){this._bSub&&(!this._subscribers||this._subscribers.size<=0)&&(this._bSubDisposer=this._bSub()),this._subscribers||(this._subscribers=new Set),this._subscribers.add(e)}remove(e){if(this._subscribers&&this._subscribers.delete(e),this._subscribers&&this._subscribers.size<=0&&this._bSubDisposer){const s=this._bSubDisposer;this._bSubDisposer=null,s()}}clear(){if(this._subscribers&&this._subscribers.clear(),this._bSubDisposer){const e=this._bSubDisposer;this._bSubDisposer=null,e()}}destroy(){this.clear()}}class _{constructor(e,s){b(this,"_subscribers");b(this,"_value");this._value=e;let i;if(s&&(s.compare&&(this.compare=s.compare),s.beforeSubscribe)){const t=s.beforeSubscribe,u=this._setValue.bind(this);i=()=>t(u)}this._subscribers=new C(i)}_setValue(e,s){this.compare(e,this._value)||(this._value=e,this._subscribers.invoke(e,s))}get value(){return this._value}reaction(e){return this._subscribers.add(e),()=>{this._subscribers.remove(e)}}subscribe(e,s){const i=this.reaction(e);return e(this._value,s),i}destroy(){this._subscribers.destroy()}unsubscribe(e){this._subscribers.remove(e)}compare(e,s){return e===s}}class O extends _{constructor(){super(...arguments);b(this,"setValue",this._setValue)}}class v extends _{constructor(s,i,t={}){super(i(s.value),d(l({},t),{beforeSubscribe:u=>{const c=s.subscribe((n,a)=>u(i(n),a));if(t.beforeSubscribe){const n=t.beforeSubscribe(u);if(n)return()=>{c(),n()}}return c}}));b(this,"_srcValue");this._srcValue=()=>i(s.value)}get value(){if(this._subscribers.size<=0){const s=this._srcValue();return this.compare(s,this._value)?this._value:s}return this._value}}function $(r,e=i=>i,s={}){return new v(r,e,s)}class V extends _{constructor(s,i,t={}){super(i(p(s)),d(l({},t),{beforeSubscribe:u=>{let c=p(s);u(i(c));const n=s.map((o,D)=>o.reaction((m,z)=>{c=c.slice(),c[D]=m,u(i(c),z)})),a=()=>n.forEach(o=>o());if(t.beforeSubscribe){const o=t.beforeSubscribe(u);if(o)return()=>{a(),o()}}return a}}));b(this,"_srcValue");this._srcValue=()=>i(p(s))}get value(){if(this._subscribers.size<=0){const s=this._srcValue();return this.compare(s,this._value)?this._value:s}return this._value}}function p(r){return r.map(B)}function B(r){return r.value}function I(r,e=i=>i,s={}){return new V(r,e,s)}function M(r,e){Object.keys(e).forEach(s=>{S(r,s,e[s])})}function P(r){return(s,i)=>(S(r,s,i),i)}function S(r,e,s){return Object.defineProperties(r,{[e]:{get(){return s.value}},[`_${e}$`]:{value:s},[`set${R(e)}`]:{value:(i,t)=>s.setValue(i,t)}}),r}function R(r){return r[0].toUpperCase()+r.slice(1)}exports.CombinedVal=V;exports.DerivedVal=v;exports.ReadonlyVal=_;exports.Val=O;exports.bindInstance=S;exports.combine=I;exports.createInstanceBinder=P;exports.derive=$;exports.withValueEnhancer=M;
"use strict";var E=Object.defineProperty,z=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var l=(r,e,s)=>e in r?E(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,_=(r,e)=>{for(var s in e||(e={}))j.call(e,s)&&l(r,s,e[s]);if(S)for(var s of S(e))y.call(e,s)&&l(r,s,e[s]);return r},d=(r,e)=>z(r,$(e));var u=(r,e,s)=>(l(r,typeof e!="symbol"?e+"":e,s),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class O{constructor(e){u(this,"_subscribers");u(this,"_bSub");u(this,"_bSubDisposer");this._bSub=e}get size(){return this._subscribers?this._subscribers.size:0}invoke(e,s){this._subscribers&&this._subscribers.forEach(i=>i(e,s))}add(e){this._bSub&&(!this._subscribers||this._subscribers.size<=0)&&(this._bSubDisposer=this._bSub()),this._subscribers||(this._subscribers=new Set),this._subscribers.add(e)}remove(e){if(this._subscribers&&this._subscribers.delete(e),this._subscribers&&this._subscribers.size<=0&&this._bSubDisposer){const s=this._bSubDisposer;this._bSubDisposer=null,s()}}clear(){if(this._subscribers&&this._subscribers.clear(),this._bSubDisposer){const e=this._bSubDisposer;this._bSubDisposer=null,e()}}destroy(){this.clear()}}class h{constructor(e,s){u(this,"_subscribers");u(this,"_value");this._value=e;let i;if(s&&(s.compare&&(this.compare=s.compare),s.beforeSubscribe)){const t=s.beforeSubscribe,b=this._setValue.bind(this);i=()=>t(b)}this._subscribers=new O(i)}_setValue(e,s){this.compare(e,this._value)||(this._value=e,this._subscribers.invoke(e,s))}get value(){return this._value}reaction(e){return this._subscribers.add(e),()=>{this._subscribers.remove(e)}}subscribe(e,s){const i=this.reaction(e);return e(this._value,s),i}destroy(){this._subscribers.destroy()}unsubscribe(e){this._subscribers.remove(e)}compare(e,s){return e===s}}class R extends h{constructor(){super(...arguments);u(this,"setValue",this._setValue)}}class V extends h{constructor(s,i,t={}){super(i(s.value),d(_({},t),{beforeSubscribe:b=>{const c=s.subscribe((n,o)=>b(i(n),o));if(t.beforeSubscribe){const n=t.beforeSubscribe(b);if(n)return()=>{c(),n()}}return c}}));u(this,"_srcValue");this._srcValue=()=>i(s.value)}get value(){if(this._subscribers.size<=0){const s=this._srcValue();return this.compare(s,this._value)?this._value:s}return this._value}}function x(r,e=i=>i,s={}){return new V(r,e,s)}class v extends h{constructor(s,i,t={}){super(i(f(s)),d(_({},t),{beforeSubscribe:b=>{let c=f(s);b(i(c));const n=s.map((a,D)=>a.reaction((m,w)=>{c=c.slice(),c[D]=m,b(i(c),w)})),o=()=>n.forEach(a=>a());if(t.beforeSubscribe){const a=t.beforeSubscribe(b);if(a)return()=>{o(),a()}}return o}}));u(this,"_srcValue");this._srcValue=()=>i(f(s))}get value(){if(this._subscribers.size<=0){const s=this._srcValue();return this.compare(s,this._value)?this._value:s}return this._value}}function f(r){return r.map(C)}function C(r){return r.value}function I(r,e=i=>i,s={}){return new v(r,e,s)}function P(r,e){Object.keys(e).forEach(s=>{B(r,s,e[s])})}function B(r,e,s){return Object.defineProperties(r,{[e]:{get(){return s.value}},[`_${e}$`]:{value:s}}),r}function M(r,e){Object.keys(e).forEach(s=>{p(r,s,e[s])})}function T(r){return(s,i)=>(p(r,s,i),i)}function p(r,e,s){return Object.defineProperties(r,{[e]:{get(){return s.value}},[`_${e}$`]:{value:s},[`set${U(e)}`]:{value:(i,t)=>s.setValue(i,t)}}),r}function U(r){return r[0].toUpperCase()+r.slice(1)}exports.CombinedVal=v;exports.DerivedVal=V;exports.ReadonlyVal=h;exports.Val=R;exports.bindInstance=p;exports.combine=I;exports.createInstanceBinder=T;exports.derive=x;exports.withReadonlyValueEnhancer=P;exports.withValueEnhancer=M;
//# sourceMappingURL=value-enhancer.cjs.js.map

@@ -6,2 +6,3 @@ export * from "./typings";

export * from "./combine";
export * from "./with-readonly-value-enhancer";
export * from "./with-value-enhancer";

@@ -203,2 +203,20 @@ var __defProp = Object.defineProperty;

}
function withReadonlyValueEnhancer(instance, config) {
Object.keys(config).forEach((key) => {
bindInstance$1(instance, key, config[key]);
});
}
function bindInstance$1(instance, key, val) {
Object.defineProperties(instance, {
[key]: {
get() {
return val.value;
}
},
[`_${key}$`]: {
value: val
}
});
return instance;
}
function withValueEnhancer(instance, config) {

@@ -235,3 +253,3 @@ Object.keys(config).forEach((key) => {

}
export { CombinedVal, DerivedVal, ReadonlyVal, Val, bindInstance, combine, createInstanceBinder, derive, withValueEnhancer };
export { CombinedVal, DerivedVal, ReadonlyVal, Val, bindInstance, combine, createInstanceBinder, derive, withReadonlyValueEnhancer, withValueEnhancer };
//# sourceMappingURL=value-enhancer.es.js.map
{
"name": "value-enhancer",
"version": "1.0.4",
"version": "1.1.0",
"private": false,

@@ -5,0 +5,0 @@ "description": "A tiny library to enhance value with reactive wrapper.",

@@ -6,2 +6,3 @@ export * from "./typings";

export * from "./combine";
export * from "./with-readonly-value-enhancer";
export * from "./with-value-enhancer";

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