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

uhooks

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uhooks - npm Package Compare versions

Comparing version 0.2.8 to 0.3.0

2

async.js

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

self.uhooks=function(e){"use strict";var t=Promise;let n=null,s=new Set;const c=e=>{const{$:t,r:n,h:s}=e;i(n)&&(o.get(s).delete(e),n()),i(e.r=t())&&o.get(s).add(e)},a=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},o=new WeakMap,r=[],u=[];function h(e,t){return e!==this[t]}const l=()=>n,i=e=>"function"==typeof e,f=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return s;function s(){const s=n;n=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=s,r.length&&p.then(r.forEach.bind(r.splice(0),c)),u.length&&u.splice(0).forEach(c)}}},p=new t((e=>e()));function d(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const g=(e,t)=>{const n=l(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(h,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},w=e=>(t,n)=>{const s=l(),{i:c,s:a,h:r}=s,u=c===a.length;s.i++,u&&(o.has(r)||o.set(r,new Set),a[c]={$:t,_:n,r:null,h:r}),(u||!n||n.some(h,a[c]._))&&e.push(a[c]),a[c].$=t,a[c]._=n},y=w(r),E=w(u),$=(e,t)=>i(t)?t(e):t,_=(e,t,n)=>{const c=l(),{i:o,s:r}=c;o===r.length&&r.push({$:i(n)?n(t):$(void 0,t),set:t=>{r[o].$=e(r[o].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),p.then(a))})(c)}});const{$:u,set:h}=r[c.i++];return[u,h]},v=new WeakMap;return e.createContext=e=>({_:new Set,provide:d,value:e}),e.dropEffect=e=>(e=>{const t=o.get(e);t&&p.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))})(v.get(e)),e.hasEffect=e=>(e=>o.has(e))(v.get(e)),e.hooked=e=>{const t=f(e);return v.set(n,t),n;async function n(){return await t.apply(this,arguments)}},e.useCallback=(e,t)=>g((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(l()),t),e.useEffect=y,e.useLayoutEffect=E,e.useMemo=g,e.useReducer=_,e.useRef=e=>{const t=l(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>_($,e),e.wait=p,e}({});
self.uhooks=function(e){"use strict";var t=Promise;let n=null,s=new Set;const c=e=>{const{$:t,r:n,h:s}=e;i(n)&&(o.get(s).delete(e),n()),i(e.r=t())&&o.get(s).add(e)},a=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},o=new WeakMap,r=[],u=[];function h(e,t){return e!==this[t]}const l=()=>n,i=e=>"function"==typeof e,f=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return s;function s(){const s=n;n=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=s,r.length&&p.then(r.forEach.bind(r.splice(0),c)),u.length&&u.splice(0).forEach(c)}}},p=new t((e=>e()));function d(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const g=(e,t)=>{const n=l(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(h,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},w=e=>(t,n)=>{const s=l(),{i:c,s:a,h:r}=s,u=c===a.length;s.i++,u&&(o.has(r)||o.set(r,new Set),a[c]={$:t,_:n,r:null,d:!1,h:r}),(u||!n||a[c].d||n.some(h,a[c]._))&&e.push(a[c]),a[c].$=t,a[c]._=n},y=w(r),E=w(u),$=(e,t)=>i(t)?t(e):t,_=(e,t,n)=>{const c=l(),{i:o,s:r}=c;o===r.length&&r.push({$:i(n)?n(t):$(void 0,t),set:t=>{r[o].$=e(r[o].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),p.then(a))})(c)}});const{$:u,set:h}=r[c.i++];return[u,h]},v=new WeakMap;return e.createContext=e=>({_:new Set,provide:d,value:e}),e.dropEffect=e=>(e=>{const t=o.get(e);t&&p.then((()=>{t.forEach((e=>{e.r(),e.r=null,e.d=!0})),t.clear()}))})(v.get(e)),e.hasEffect=e=>(e=>o.has(e))(v.get(e)),e.hooked=e=>{const t=f(e);return v.set(n,t),n;async function n(){return await t.apply(this,arguments)}},e.useCallback=(e,t)=>g((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(l()),t),e.useEffect=y,e.useLayoutEffect=E,e.useMemo=g,e.useReducer=_,e.useRef=e=>{const t=l(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>_($,e),e.wait=p,e}({});

@@ -12,5 +12,5 @@ 'use strict';

fx.set(h, new Set);
s[i] = {$: callback, _: guards, r: null, h};
s[i] = {$: callback, _: guards, r: null, d: false, h};
}
if (call || !guards || guards.some(different, s[i]._))
if (call || !guards || s[i].d || guards.some(different, s[i]._))
stack.push(s[i]);

@@ -17,0 +17,0 @@ s[i].$ = callback;

@@ -46,2 +46,3 @@ 'use strict';

effect.r = null;
effect.d = true;
});

@@ -48,0 +49,0 @@ effects.clear();

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

self.uhooks=function(e){"use strict";var t=Promise;let n=null,s=new Set;const c=e=>{const{$:t,r:n,h:s}=e;i(n)&&(u.get(s).delete(e),n()),i(e.r=t())&&u.get(s).add(e)},o=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},u=new WeakMap,r=[],a=[];function h(e,t){return e!==this[t]}const l=()=>n,i=e=>"function"==typeof e,f=new t((e=>e()));function p(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const d=(e,t)=>{const n=l(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(h,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},g=e=>(t,n)=>{const s=l(),{i:c,s:o,h:r}=s,a=c===o.length;s.i++,a&&(u.has(r)||u.set(r,new Set),o[c]={$:t,_:n,r:null,h:r}),(a||!n||n.some(h,o[c]._))&&e.push(o[c]),o[c].$=t,o[c]._=n},E=g(r),$=g(a),_=(e,t)=>i(t)?t(e):t,v=(e,t,n)=>{const c=l(),{i:u,s:r}=c;u===r.length&&r.push({$:i(n)?n(t):_(void 0,t),set:t=>{r[u].$=e(r[u].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),f.then(o))})(c)}});const{$:a,set:h}=r[c.i++];return[a,h]};return e.createContext=e=>({_:new Set,provide:p,value:e}),e.dropEffect=e=>{const t=u.get(e);t&&f.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))},e.hasEffect=e=>u.has(e),e.hooked=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return s;function s(){const s=n;n=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=s,r.length&&f.then(r.forEach.bind(r.splice(0),c)),a.length&&a.splice(0).forEach(c)}}},e.useCallback=(e,t)=>d((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(l()),t),e.useEffect=E,e.useLayoutEffect=$,e.useMemo=d,e.useReducer=v,e.useRef=e=>{const t=l(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>v(_,e),e.wait=f,e}({});
self.uhooks=function(e){"use strict";var t=Promise;let n=null,s=new Set;const c=e=>{const{$:t,r:n,h:s}=e;i(n)&&(u.get(s).delete(e),n()),i(e.r=t())&&u.get(s).add(e)},o=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},u=new WeakMap,r=[],a=[];function h(e,t){return e!==this[t]}const l=()=>n,i=e=>"function"==typeof e,f=new t((e=>e()));function d(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const p=(e,t)=>{const n=l(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(h,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},g=e=>(t,n)=>{const s=l(),{i:c,s:o,h:r}=s,a=c===o.length;s.i++,a&&(u.has(r)||u.set(r,new Set),o[c]={$:t,_:n,r:null,d:!1,h:r}),(a||!n||o[c].d||n.some(h,o[c]._))&&e.push(o[c]),o[c].$=t,o[c]._=n},E=g(r),$=g(a),_=(e,t)=>i(t)?t(e):t,v=(e,t,n)=>{const c=l(),{i:u,s:r}=c;u===r.length&&r.push({$:i(n)?n(t):_(void 0,t),set:t=>{r[u].$=e(r[u].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),f.then(o))})(c)}});const{$:a,set:h}=r[c.i++];return[a,h]};return e.createContext=e=>({_:new Set,provide:d,value:e}),e.dropEffect=e=>{const t=u.get(e);t&&f.then((()=>{t.forEach((e=>{e.r(),e.r=null,e.d=!0})),t.clear()}))},e.hasEffect=e=>u.has(e),e.hooked=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return s;function s(){const s=n;n=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=s,r.length&&f.then(r.forEach.bind(r.splice(0),c)),a.length&&a.splice(0).forEach(c)}}},e.useCallback=(e,t)=>p((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(l()),t),e.useEffect=E,e.useLayoutEffect=$,e.useMemo=p,e.useReducer=v,e.useRef=e=>{const t=l(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>v(_,e),e.wait=f,e}({});

@@ -11,5 +11,5 @@ import {fx, effects, layoutEffects, different, getInfo} from './hooks.js';

fx.set(h, new Set);
s[i] = {$: callback, _: guards, r: null, h};
s[i] = {$: callback, _: guards, r: null, d: false, h};
}
if (call || !guards || guards.some(different, s[i]._))
if (call || !guards || s[i].d || guards.some(different, s[i]._))
stack.push(s[i]);

@@ -16,0 +16,0 @@ s[i].$ = callback;

@@ -41,2 +41,3 @@ import Lie from '@webreflection/lie';

effect.r = null;
effect.d = true;
});

@@ -43,0 +44,0 @@ effects.clear();

@@ -64,2 +64,3 @@ self.uhooks = (function (exports) {

effect.r = null;
effect.d = true;
});

@@ -178,2 +179,3 @@ effects.clear();

r: null,
d: false,
h: h

@@ -183,3 +185,3 @@ };

if (call || !guards || guards.some(different, s[i]._)) stack.push(s[i]);
if (call || !guards || s[i].d || guards.some(different, s[i]._)) stack.push(s[i]);
s[i].$ = callback;

@@ -186,0 +188,0 @@ s[i]._ = guards;

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

self.uhooks=function(n){"use strict";var t="function"==typeof Promise?Promise:function(n){var t,e=[],u=0;return n((function(n){t=n,u=1,e.splice(0).forEach(r)})),{then:r};function r(n){return u?setTimeout(n,0,t):e.push(n),this}},e=null,u=new Set,r=function(n){var t=n.$,e=n.r,u=n.h;h(e)&&(o.get(u).delete(n),e()),h(n.r=t())&&o.get(u).add(n)},i=function(){var n=u;u=new Set,n.forEach((function(n){var t=n.h,e=n.c,u=n.a;n.e&&t.apply(e,u)}))},o=new WeakMap,c=[],f=[];function a(n,t){return n!==this[t]}var s=function(){return e},h=function(n){return"function"==typeof n},l=new t((function(n){return n()}));function v(n){var t=this._;this.value!==n&&(this._=new Set,this.value=n,t.forEach((function(n){var t=n.h,e=n.c,u=n.a;t.apply(e,u)})))}var p=function(n,t){var e=s(),u=e.i,r=e.s;return u!==r.length&&t&&!t.some(a,r[u]._)||(r[u]={$:n(),_:t}),r[e.i++].$},d=function(n){return function(t,e){var u=s(),r=u.i,i=u.s,c=u.h,f=r===i.length;u.i++,f&&(o.has(c)||o.set(c,new Set),i[r]={$:t,_:e,r:null,h:c}),(f||!e||e.some(a,i[r]._))&&n.push(i[r]),i[r].$=t,i[r]._=e}},E=d(c),g=d(f),$=function(n,t){return h(t)?t(n):t},_=function(n,t,e){var r=s(),o=r.i,c=r.s;o===c.length&&c.push({$:h(e)?e(t):$(void 0,t),set:function(t){c[o].$=n(c[o].$,t),function(n){u.has(n)||(n.e=1,u.add(n),l.then(i))}(r)}});var f=c[r.i++];return[f.$,f.set]};return n.createContext=function(n){return{_:new Set,provide:v,value:n}},n.dropEffect=function(n){var t=o.get(n);t&&l.then((function(){t.forEach((function(n){n.r(),n.r=null})),t.clear()}))},n.hasEffect=function(n){return o.has(n)},n.hooked=function(n){var t={h:u,c:null,a:null,e:0,i:0,s:[]};return u;function u(){var u=e;e=t,t.e=t.i=0;try{return n.apply(t.c=this,t.a=arguments)}finally{e=u,c.length&&l.then(c.forEach.bind(c.splice(0),r)),f.length&&f.splice(0).forEach(r)}}},n.useCallback=function(n,t){return p((function(){return n}),t)},n.useContext=function(n){var t=n._,e=n.value;return t.add(s()),e},n.useEffect=E,n.useLayoutEffect=g,n.useMemo=p,n.useReducer=_,n.useRef=function(n){var t=s(),e=t.i,u=t.s;return e===u.length&&u.push({current:n}),u[t.i++]},n.useState=function(n){return _($,n)},n.wait=l,n}({});
self.uhooks=function(n){"use strict";var t="function"==typeof Promise?Promise:function(n){var t,e=[],u=0;return n((function(n){t=n,u=1,e.splice(0).forEach(r)})),{then:r};function r(n){return u?setTimeout(n,0,t):e.push(n),this}},e=null,u=new Set,r=function(n){var t=n.$,e=n.r,u=n.h;h(e)&&(o.get(u).delete(n),e()),h(n.r=t())&&o.get(u).add(n)},i=function(){var n=u;u=new Set,n.forEach((function(n){var t=n.h,e=n.c,u=n.a;n.e&&t.apply(e,u)}))},o=new WeakMap,c=[],f=[];function a(n,t){return n!==this[t]}var s=function(){return e},h=function(n){return"function"==typeof n},l=new t((function(n){return n()}));function v(n){var t=this._;this.value!==n&&(this._=new Set,this.value=n,t.forEach((function(n){var t=n.h,e=n.c,u=n.a;t.apply(e,u)})))}var p=function(n,t){var e=s(),u=e.i,r=e.s;return u!==r.length&&t&&!t.some(a,r[u]._)||(r[u]={$:n(),_:t}),r[e.i++].$},d=function(n){return function(t,e){var u=s(),r=u.i,i=u.s,c=u.h,f=r===i.length;u.i++,f&&(o.has(c)||o.set(c,new Set),i[r]={$:t,_:e,r:null,d:!1,h:c}),(f||!e||i[r].d||e.some(a,i[r]._))&&n.push(i[r]),i[r].$=t,i[r]._=e}},E=d(c),g=d(f),$=function(n,t){return h(t)?t(n):t},_=function(n,t,e){var r=s(),o=r.i,c=r.s;o===c.length&&c.push({$:h(e)?e(t):$(void 0,t),set:function(t){c[o].$=n(c[o].$,t),function(n){u.has(n)||(n.e=1,u.add(n),l.then(i))}(r)}});var f=c[r.i++];return[f.$,f.set]};return n.createContext=function(n){return{_:new Set,provide:v,value:n}},n.dropEffect=function(n){var t=o.get(n);t&&l.then((function(){t.forEach((function(n){n.r(),n.r=null,n.d=!0})),t.clear()}))},n.hasEffect=function(n){return o.has(n)},n.hooked=function(n){var t={h:u,c:null,a:null,e:0,i:0,s:[]};return u;function u(){var u=e;e=t,t.e=t.i=0;try{return n.apply(t.c=this,t.a=arguments)}finally{e=u,c.length&&l.then(c.forEach.bind(c.splice(0),r)),f.length&&f.splice(0).forEach(r)}}},n.useCallback=function(n,t){return p((function(){return n}),t)},n.useContext=function(n){var t=n._,e=n.value;return t.add(s()),e},n.useEffect=E,n.useLayoutEffect=g,n.useMemo=p,n.useReducer=_,n.useRef=function(n){var t=s(),e=t.i,u=t.s;return e===u.length&&u.push({current:n}),u[t.i++]},n.useState=function(n){return _($,n)},n.wait=l,n}({});
{
"name": "uhooks",
"version": "0.2.8",
"version": "0.3.0",
"description": "micro hooks: a minimalistic client/server hooks' implementation",

@@ -28,14 +28,14 @@ "main": "./cjs/index.js",

"devDependencies": {
"@babel/core": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@ungap/degap": "^0.2.4",
"@rollup/plugin-node-resolve": "^13.0.0",
"@ungap/degap": "^0.2.6",
"ascjs": "^5.0.1",
"c8": "^7.6.0",
"c8": "^7.7.3",
"coveralls": "^3.1.0",
"rollup": "^2.39.0",
"rollup": "^2.52.3",
"rollup-plugin-includepaths": "^0.2.4",
"rollup-plugin-terser": "^7.0.2",
"terser": "^5.6.0"
"terser": "^5.7.0"
},

@@ -42,0 +42,0 @@ "module": "./esm/index.js",

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