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

hooks-mixin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hooks-mixin - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

build/index.js

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

"use strict";function hook(a,b){if(!(a&&"string"==typeof a))throw new TypeError("name should be non empty string");if("function"!=typeof b)throw new TypeError("fn is not a function");this.__hooks||(this.__hooks={}),this.__hooks[a]||(this.__hooks[a]=[]),this.__hooks[a].push(b)}function getHooks(a,b){return a.__hooks&&a.__hooks[b]?a.__hooks[b]:null}function removeHook(a,b){var c=getHooks(this,a);if(!c)return null;var d=c.indexOf(b);return-1===d?null:(c.splice(d,1),b)}function getHookArguments(a,b){var c=Array.from(b);return c.shift(),c.push(a),c}function processHooks(a){var b=getHooks(this,a);if(b){var c=getHookArguments(this,arguments),d=!0,e=!1,f=void 0;try{for(var g,h,i=b[Symbol.iterator]();!(d=(g=i.next()).done);d=!0)h=g.value,h.apply(null,c)}catch(a){e=!0,f=a}finally{try{d||null==i["return"]||i["return"]()}finally{if(e)throw f}}}}function processHooksAsync(a){var b=getHooks(this,a);if(b){var c=getHookArguments(this,arguments);return Promise.all(b.map(function(a){return a.apply(null,c)}))}}module.exports=function(a){return a.prototype.hook=hook,a.prototype.removeHook=removeHook,a.prototype.processHooks=processHooks,a.prototype.processHooksAsync=processHooksAsync,a};
"use strict";function _createForOfIteratorHelper(a){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(a=_unsupportedIterableToArray(a))){var b=0,c=function(){};return{s:c,n:function n(){return b>=a.length?{done:!0}:{done:!1,value:a[b++]}},e:function e(a){throw a},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d,e,f=!0,g=!1;return{s:function s(){d=a[Symbol.iterator]()},n:function n(){var a=d.next();return f=a.done,a},e:function e(a){g=!0,e=a},f:function f(){try{f||null==d["return"]||d["return"]()}finally{if(g)throw e}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(c):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function hook(a,b){if(!(a&&"string"==typeof a))throw new TypeError("name should be non empty string");if("function"!=typeof b)throw new TypeError("fn is not a function");this.__hooks||(this.__hooks={}),this.__hooks[a]||(this.__hooks[a]=[]),this.__hooks[a].push(b)}function getHooks(a,b){return a.__hooks&&a.__hooks[b]?a.__hooks[b]:null}function removeHook(a,b){var c=getHooks(this,a);if(!c)return null;var d=c.indexOf(b);return-1===d?null:(c.splice(d,1),b)}function getHookArguments(a,b){var c=Array.from(b);return c.shift(),c.push(a),c}function processHooks(a){var b=getHooks(this,a);if(b){var c,d=getHookArguments(this,arguments),e=_createForOfIteratorHelper(b);try{for(e.s();!(c=e.n()).done;){var f=c.value;f.apply(null,d)}}catch(a){e.e(a)}finally{e.f()}}}function processHooksAsync(a){var b=getHooks(this,a);if(b){var c=getHookArguments(this,arguments);return Promise.all(b.map(function(a){return a.apply(null,c)}))}}module.exports=function(a){return a.prototype.hook=hook,a.prototype.removeHook=removeHook,a.prototype.processHooks=processHooks,a.prototype.processHooksAsync=processHooksAsync,a};
{
"name": "hooks-mixin",
"version": "1.2.1",
"version": "1.2.2",
"description": "A small mixin for classes. Adds hooks ability to your classes",

@@ -21,10 +21,10 @@ "main": "index.js",

"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/preset-env": "^7.5.4",
"babel-eslint": "^10.0.2",
"babel-preset-minify": "^0.5.0",
"eslint": "^6.0.1",
"jest": "^24.8.0"
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"babel-eslint": "^10.1.0",
"babel-preset-minify": "^0.5.1",
"eslint": "^6.8.0",
"jest": "^25.2.7"
}
}
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