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

reffects

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reffects - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

2

dist/reffects.es.js

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

var n="development"===process.env.NODE_ENV,o={effects:{},coeffects:{},events:{}},t=Object.assign({},o),e={};function c(o){j(o,"event");var t=function(n){return y(n)?{id:n}:n}(o),c=t.id,i=t.payload;!function(o,t){n&&(console.groupCollapsed("Dispatching event: "+o),console.info("EventId:",o),console.log("Payload:",t),console.groupEnd())}(c,i),function(o){o&&Object.entries(o).forEach(function(o){var t=o[0],e=o[1];!function(o,t){n&&(console.groupCollapsed("Applying effect: "+o),console.info("Effect id:",o),t&&console.log("Effect data:",coeffectDescription.data),console.groupEnd())}(t,e),E(t)(e)})}(g(c)(e[c].reduce(function(o,t){return Object.assign({},o,function(o){return j(o,"coeffect"),function(o){n&&(console.groupCollapsed("Extracting values of coeffect: "+o.id),console.info("Coeffect id:",o.id),console.log("Coeffect data:",o.data),console.groupEnd())}(o),y(o)?p(o)():p(o.id)(o.data)}(t))},{}),i))}function i(n){n.forEach(function(n){c(n)})}function f(n,o,t){void 0===t&&(t=[]),l("events",n,o),e[n]=t}function r(n,o){l("coeffects",n,o)}function a(n,o){l("effects",n,o)}function u(n,o){n.forEach(function(n){f(n,function(n,t){return{dispatch:{id:o,payload:t}}})})}function s(n,o){var e=t[n][o];if(!e)throw new Error("There is no handler called '"+o+"'.");return e}function d(n,o){return o?{id:n,data:o}:n}function l(n,o,e){t[n][o]=e}function p(n){return s("coeffects",n)}function E(n){return s("effects",n)}function g(n){return s("events",n)}function v(){t=Object.assign({},o),e={}}function h(o){n=o}a("dispatch",function(n){c(n)}),a("dispatchMany",function(n){i(n)}),a("dispatchLater",function(n){!function(n){setTimeout(function(){c(n)},n.milliseconds)}(n)});var b=Object.prototype.toString;function y(n){var o=typeof n;return"string"===o||"object"===o&&null!=n&&!Array.isArray(n)&&"[object String]"===b.call(n)}function j(n,o){var t={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};n||function(n){throw new Error("Not defined "+o+".\n"+t[o])}(),y(n)||null!=n.id||function(n){throw new Error("Not valid "+o+".\n"+t[o])}()}export{c as dispatch,i as dispatchMany,f as registerEventHandler,r as registerCoeffectHandler,a as registerEffectHandler,u as registerEventsDelegation,d as coeffect,p as getCoeffectHandler,E as getEffectHandler,g as getEventHandler,v as clearHandlers,h as setVerbosity};
var n="development"===process.env.NODE_ENV,o={effects:{},coeffects:{},events:{}},e=Object.assign({},o),t={};function c(o){j(o,"event");var e=function(n){return b(n)?{id:n}:n}(o);!function(o){var t=e.id,c=e.payload;n&&(console.groupCollapsed("Dispatching event: "+t),console.info("EventId:",t),c?console.info("Payload:",c):console.info("Payload:","The "+t+" event has no payload."),console.groupEnd())}();var c=e.id,f=e.payload;!function(o){o&&Object.entries(o).forEach(function(o){var e=o[0],t=o[1];!function(o,e){n&&(console.groupCollapsed("Applying effect: "+o),console.info("Effect id:",o),e?console.info("Effect data:",e):console.info("Effect data:","The "+o+" effect needs no data"),console.groupEnd())}(e,t),v(e)(t)})}(E(c)(t[c].reduce(function(o,e){return Object.assign({},o,function(o){j(o,"coeffect");var e=function(n){return b(n)?{id:n}:n}(o),t=p(e.id)(e.data);return function(o,t){var c=e.id,f=e.data;n&&(console.groupCollapsed("Extracting values of coeffect: "+c),console.info("Coeffect id:",c),f?console.info("Coeffect data:",f):console.info("Coeffect data:","The "+c+" coeffect needs no data"),console.info("Extracted value:",t),console.groupEnd())}(0,t),t}(e))},{}),f))}function f(n){n.forEach(function(n){c(n)})}function i(n,o,e){void 0===e&&(e=[]),l("events",n,o),t[n]=e}function a(n,o){l("coeffects",n,o)}function r(n,o){l("effects",n,o)}function u(n,o){n.forEach(function(n){i(n,function(n,e){return{dispatch:{id:o,payload:e}}})})}function d(n,o){var t=e[n][o];if(!t)throw new Error("There is no handler called '"+o+"'.");return t}function s(n,o){return o?{id:n,data:o}:n}function l(n,o,t){e[n][o]=t}function p(n){return d("coeffects",n)}function v(n){return d("effects",n)}function E(n){return d("events",n)}function h(){e=Object.assign({},o),t={}}function g(o){n=o}r("dispatch",function(n){c(n)}),r("dispatchMany",function(n){f(n)}),r("dispatchLater",function(n){!function(n){setTimeout(function(){c(n)},n.milliseconds)}(n)});var y=Object.prototype.toString;function b(n){var o=typeof n;return"string"===o||"object"===o&&null!=n&&!Array.isArray(n)&&"[object String]"===y.call(n)}function j(n,o){var e={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};n||function(n){throw new Error("Not defined "+o+".\n"+e[o])}(),b(n)||null!=n.id||function(n){throw new Error("Not valid "+o+".\n"+e[o])}()}export{c as dispatch,f as dispatchMany,i as registerEventHandler,a as registerCoeffectHandler,r as registerEffectHandler,u as registerEventsDelegation,s as coeffect,p as getCoeffectHandler,v as getEffectHandler,E as getEventHandler,h as clearHandlers,g as setVerbosity};
//# sourceMappingURL=reffects.es.js.map

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

var e="development"===process.env.NODE_ENV,t={effects:{},coeffects:{},events:{}},n=Object.assign({},t),o={};function c(t){E(t,"event");var n=function(e){return g(e)?{id:e}:e}(t),c=n.id,r=n.payload;!function(t,n){e&&(console.groupCollapsed("Dispatching event: "+t),console.info("EventId:",t),console.log("Payload:",n),console.groupEnd())}(c,r),function(t){t&&Object.entries(t).forEach(function(t){var n=t[0],o=t[1];!function(t,n){e&&(console.groupCollapsed("Applying effect: "+t),console.info("Effect id:",t),n&&console.log("Effect data:",coeffectDescription.data),console.groupEnd())}(n,o),u(n)(o)})}(l(c)(o[c].reduce(function(t,n){return Object.assign({},t,function(t){return E(t,"coeffect"),function(t){e&&(console.groupCollapsed("Extracting values of coeffect: "+t.id),console.info("Coeffect id:",t.id),console.log("Coeffect data:",t.data),console.groupEnd())}(t),g(t)?d(t)():d(t.id)(t.data)}(n))},{}),r))}function r(e){e.forEach(function(e){c(e)})}function i(e,t,n){void 0===n&&(n=[]),s("events",e,t),o[e]=n}function f(e,t){s("effects",e,t)}function a(e,t){var o=n[e][t];if(!o)throw new Error("There is no handler called '"+t+"'.");return o}function s(e,t,o){n[e][t]=o}function d(e){return a("coeffects",e)}function u(e){return a("effects",e)}function l(e){return a("events",e)}f("dispatch",function(e){c(e)}),f("dispatchMany",function(e){r(e)}),f("dispatchLater",function(e){!function(e){setTimeout(function(){c(e)},e.milliseconds)}(e)});var p=Object.prototype.toString;function g(e){var t=typeof e;return"string"===t||"object"===t&&null!=e&&!Array.isArray(e)&&"[object String]"===p.call(e)}function E(e,t){var n={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};e||function(e){throw new Error("Not defined "+t+".\n"+n[t])}(),g(e)||null!=e.id||function(e){throw new Error("Not valid "+t+".\n"+n[t])}()}exports.dispatch=c,exports.dispatchMany=r,exports.registerEventHandler=i,exports.registerCoeffectHandler=function(e,t){s("coeffects",e,t)},exports.registerEffectHandler=f,exports.registerEventsDelegation=function(e,t){e.forEach(function(e){i(e,function(e,n){return{dispatch:{id:t,payload:n}}})})},exports.coeffect=function(e,t){return t?{id:e,data:t}:e},exports.getCoeffectHandler=d,exports.getEffectHandler=u,exports.getEventHandler=l,exports.clearHandlers=function(){n=Object.assign({},t),o={}},exports.setVerbosity=function(t){e=t};
var e="development"===process.env.NODE_ENV,n={effects:{},coeffects:{},events:{}},t=Object.assign({},n),o={};function c(n){v(n,"event");var t=function(e){return E(e)?{id:e}:e}(n);!function(n){var o=t.id,c=t.payload;e&&(console.groupCollapsed("Dispatching event: "+o),console.info("EventId:",o),c?console.info("Payload:",c):console.info("Payload:","The "+o+" event has no payload."),console.groupEnd())}();var c=t.id,r=t.payload;!function(n){n&&Object.entries(n).forEach(function(n){var t=n[0],o=n[1];!function(n,t){e&&(console.groupCollapsed("Applying effect: "+n),console.info("Effect id:",n),t?console.info("Effect data:",t):console.info("Effect data:","The "+n+" effect needs no data"),console.groupEnd())}(t,o),u(t)(o)})}(l(c)(o[c].reduce(function(n,t){return Object.assign({},n,function(n){v(n,"coeffect");var t=function(e){return E(e)?{id:e}:e}(n),o=d(t.id)(t.data);return function(n,o){var c=t.id,r=t.data;e&&(console.groupCollapsed("Extracting values of coeffect: "+c),console.info("Coeffect id:",c),r?console.info("Coeffect data:",r):console.info("Coeffect data:","The "+c+" coeffect needs no data"),console.info("Extracted value:",o),console.groupEnd())}(0,o),o}(t))},{}),r))}function r(e){e.forEach(function(e){c(e)})}function f(e,n,t){void 0===t&&(t=[]),s("events",e,n),o[e]=t}function i(e,n){s("effects",e,n)}function a(e,n){var o=t[e][n];if(!o)throw new Error("There is no handler called '"+n+"'.");return o}function s(e,n,o){t[e][n]=o}function d(e){return a("coeffects",e)}function u(e){return a("effects",e)}function l(e){return a("events",e)}i("dispatch",function(e){c(e)}),i("dispatchMany",function(e){r(e)}),i("dispatchLater",function(e){!function(e){setTimeout(function(){c(e)},e.milliseconds)}(e)});var p=Object.prototype.toString;function E(e){var n=typeof e;return"string"===n||"object"===n&&null!=e&&!Array.isArray(e)&&"[object String]"===p.call(e)}function v(e,n){var t={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};e||function(e){throw new Error("Not defined "+n+".\n"+t[n])}(),E(e)||null!=e.id||function(e){throw new Error("Not valid "+n+".\n"+t[n])}()}exports.dispatch=c,exports.dispatchMany=r,exports.registerEventHandler=f,exports.registerCoeffectHandler=function(e,n){s("coeffects",e,n)},exports.registerEffectHandler=i,exports.registerEventsDelegation=function(e,n){e.forEach(function(e){f(e,function(e,t){return{dispatch:{id:n,payload:t}}})})},exports.coeffect=function(e,n){return n?{id:e,data:n}:e},exports.getCoeffectHandler=d,exports.getEffectHandler=u,exports.getEventHandler=l,exports.clearHandlers=function(){t=Object.assign({},n),o={}},exports.setVerbosity=function(n){e=n};
//# sourceMappingURL=reffects.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.reffects={})}(this,function(e){var n="development"===process.env.NODE_ENV,t={effects:{},coeffects:{},events:{}},o=Object.assign({},t),c={};function f(e){v(e,"event");var t=function(e){return E(e)?{id:e}:e}(e),o=t.id,f=t.payload;!function(e,t){n&&(console.groupCollapsed("Dispatching event: "+e),console.info("EventId:",e),console.log("Payload:",t),console.groupEnd())}(o,f),function(e){e&&Object.entries(e).forEach(function(e){var t=e[0],o=e[1];!function(e,t){n&&(console.groupCollapsed("Applying effect: "+e),console.info("Effect id:",e),t&&console.log("Effect data:",coeffectDescription.data),console.groupEnd())}(t,o),l(t)(o)})}(p(o)(c[o].reduce(function(e,t){return Object.assign({},e,function(e){return v(e,"coeffect"),function(e){n&&(console.groupCollapsed("Extracting values of coeffect: "+e.id),console.info("Coeffect id:",e.id),console.log("Coeffect data:",e.data),console.groupEnd())}(e),E(e)?u(e)():u(e.id)(e.data)}(t))},{}),f))}function i(e){e.forEach(function(e){f(e)})}function r(e,n,t){void 0===t&&(t=[]),d("events",e,n),c[e]=t}function a(e,n){d("effects",e,n)}function s(e,n){var t=o[e][n];if(!t)throw new Error("There is no handler called '"+n+"'.");return t}function d(e,n,t){o[e][n]=t}function u(e){return s("coeffects",e)}function l(e){return s("effects",e)}function p(e){return s("events",e)}a("dispatch",function(e){f(e)}),a("dispatchMany",function(e){i(e)}),a("dispatchLater",function(e){!function(e){setTimeout(function(){f(e)},e.milliseconds)}(e)});var g=Object.prototype.toString;function E(e){var n=typeof e;return"string"===n||"object"===n&&null!=e&&!Array.isArray(e)&&"[object String]"===g.call(e)}function v(e,n){var t={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};e||function(e){throw new Error("Not defined "+n+".\n"+t[n])}(),E(e)||null!=e.id||function(e){throw new Error("Not valid "+n+".\n"+t[n])}()}e.dispatch=f,e.dispatchMany=i,e.registerEventHandler=r,e.registerCoeffectHandler=function(e,n){d("coeffects",e,n)},e.registerEffectHandler=a,e.registerEventsDelegation=function(e,n){e.forEach(function(e){r(e,function(e,t){return{dispatch:{id:n,payload:t}}})})},e.coeffect=function(e,n){return n?{id:e,data:n}:e},e.getCoeffectHandler=u,e.getEffectHandler=l,e.getEventHandler=p,e.clearHandlers=function(){o=Object.assign({},t),c={}},e.setVerbosity=function(e){n=e}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.reffects={})}(this,function(e){var n="development"===process.env.NODE_ENV,t={effects:{},coeffects:{},events:{}},o=Object.assign({},t),c={};function f(e){g(e,"event");var t=function(e){return v(e)?{id:e}:e}(e);!function(e){var o=t.id,c=t.payload;n&&(console.groupCollapsed("Dispatching event: "+o),console.info("EventId:",o),c?console.info("Payload:",c):console.info("Payload:","The "+o+" event has no payload."),console.groupEnd())}();var o=t.id,f=t.payload;!function(e){e&&Object.entries(e).forEach(function(e){var t=e[0],o=e[1];!function(e,t){n&&(console.groupCollapsed("Applying effect: "+e),console.info("Effect id:",e),t?console.info("Effect data:",t):console.info("Effect data:","The "+e+" effect needs no data"),console.groupEnd())}(t,o),l(t)(o)})}(p(o)(c[o].reduce(function(e,t){return Object.assign({},e,function(e){g(e,"coeffect");var t=function(e){return v(e)?{id:e}:e}(e),o=u(t.id)(t.data);return function(e,o){var c=t.id,f=t.data;n&&(console.groupCollapsed("Extracting values of coeffect: "+c),console.info("Coeffect id:",c),f?console.info("Coeffect data:",f):console.info("Coeffect data:","The "+c+" coeffect needs no data"),console.info("Extracted value:",o),console.groupEnd())}(0,o),o}(t))},{}),f))}function i(e){e.forEach(function(e){f(e)})}function a(e,n,t){void 0===t&&(t=[]),s("events",e,n),c[e]=t}function r(e,n){s("effects",e,n)}function d(e,n){var t=o[e][n];if(!t)throw new Error("There is no handler called '"+n+"'.");return t}function s(e,n,t){o[e][n]=t}function u(e){return d("coeffects",e)}function l(e){return d("effects",e)}function p(e){return d("events",e)}r("dispatch",function(e){f(e)}),r("dispatchMany",function(e){i(e)}),r("dispatchLater",function(e){!function(e){setTimeout(function(){f(e)},e.milliseconds)}(e)});var E=Object.prototype.toString;function v(e){var n=typeof e;return"string"===n||"object"===n&&null!=e&&!Array.isArray(e)&&"[object String]"===E.call(e)}function g(e,n){var t={coeffect:"It must be an object with the following format `{ id: 'COEFFECT_ID', data: <Object | any> }`, or a string if no data is needed: 'EVENT_ID'",event:"It must be an object with the following format `{ id: 'EVENT_ID', payload: <Object | any> }`, or a string if no payload is needed: 'EVENT_ID'"};e||function(e){throw new Error("Not defined "+n+".\n"+t[n])}(),v(e)||null!=e.id||function(e){throw new Error("Not valid "+n+".\n"+t[n])}()}e.dispatch=f,e.dispatchMany=i,e.registerEventHandler=a,e.registerCoeffectHandler=function(e,n){s("coeffects",e,n)},e.registerEffectHandler=r,e.registerEventsDelegation=function(e,n){e.forEach(function(e){a(e,function(e,t){return{dispatch:{id:n,payload:t}}})})},e.coeffect=function(e,n){return n?{id:e,data:n}:e},e.getCoeffectHandler=u,e.getEffectHandler=l,e.getEventHandler=p,e.clearHandlers=function(){o=Object.assign({},t),c={}},e.setVerbosity=function(e){n=e}});
//# sourceMappingURL=reffects.umd.js.map
{
"name": "reffects",
"version": "0.1.4",
"version": "0.1.5",
"description": "",

@@ -5,0 +5,0 @@ "source": "src/index.js",

@@ -12,7 +12,11 @@ var verbosityOn = process.env.NODE_ENV === 'development';

function logEvent(eventId, payload) {
function logEvent({ id, payload }) {
if (verbosityOn) {
console.groupCollapsed(`Dispatching event: ${eventId}`);
console.info('EventId:', eventId);
console.log('Payload:', payload);
console.groupCollapsed(`Dispatching event: ${id}`);
console.info('EventId:', id);
if (!payload) {
console.info('Payload:', `The ${id} event has no payload.`);
} else {
console.info('Payload:', payload);
}
console.groupEnd();

@@ -22,7 +26,12 @@ }

function logCoeffect(coeffectDescription) {
function logCoeffect({id, data}, value) {
if (verbosityOn) {
console.groupCollapsed(`Extracting values of coeffect: ${coeffectDescription.id}`);
console.info('Coeffect id:', coeffectDescription.id);
console.log('Coeffect data:', coeffectDescription.data);
console.groupCollapsed(`Extracting values of coeffect: ${id}`);
console.info('Coeffect id:', id);
if(!data) {
console.info('Coeffect data:', `The ${id} coeffect needs no data`);
} else {
console.info('Coeffect data:', data);
}
console.info('Extracted value:', value);
console.groupEnd();

@@ -36,4 +45,6 @@ }

console.info('Effect id:', effectId);
if (effectData) {
console.log('Effect data:', coeffectDescription.data);
if (!effectData) {
console.info('Effect data:', `The ${effectId} effect needs no data`);
} else {
console.info('Effect data:', effectData);
}

@@ -44,14 +55,16 @@ console.groupEnd();

function extractCoeffectValue(coeffectDescription) {
checkElementValidity(coeffectDescription, "coeffect")
logCoeffect(coeffectDescription);
function normalizeCoeffectDescription(coeffectDescription) {
if (isString(coeffectDescription)) {
const coeffectId = coeffectDescription;
const coeffectHandler = getCoeffectHandler(coeffectId);
return coeffectHandler();
return {id:coeffectDescription};
}
return coeffectDescription;
}
const coeffectHandler = getCoeffectHandler(coeffectDescription.id);
return coeffectHandler(coeffectDescription.data);
function extractCoeffectValue(coeffectDescription) {
checkElementValidity(coeffectDescription, "coeffect");
const normalizedCoeffectDescription = normalizeCoeffectDescription(coeffectDescription);
const coeffectHandler = getCoeffectHandler(normalizedCoeffectDescription.id);
const value = coeffectHandler(normalizedCoeffectDescription.data);
logCoeffect(normalizedCoeffectDescription, value);
return value;
}

@@ -72,10 +85,12 @@

}
Object.entries(effects).forEach(function([effectId, effectData]) {
logEffect(effectId, effectData);
const effectHandler = getEffectHandler(effectId);
effectHandler(effectData);
});
Object.entries(effects).forEach(
function([effectId, effectData]) {
logEffect(effectId, effectData);
const effectHandler = getEffectHandler(effectId);
effectHandler(effectData);
}
);
}
function completeEventParts(event) {
function normalizeEvent(event) {
if(isString(event)) {

@@ -89,4 +104,5 @@ return {id: event};

checkElementValidity(event, "event");
const { id, payload } = completeEventParts(event);
logEvent(id, payload);
const normalizedEvent = normalizeEvent(event);
logEvent(normalizedEvent);
const { id, payload } = normalizedEvent;
const eventHandler = getEventHandler(id);

@@ -225,2 +241,1 @@ const coeffectDescriptions = coeffectsByEvent[id];

}

Sorry, the diff of this file is not supported yet

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