Socket
Socket
Sign inDemoInstall

@wordpress/hooks

Package Overview
Dependencies
Maintainers
6
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/hooks - npm Package Compare versions

Comparing version 1.1.8 to 1.2.0

12

build-module/createRunHook.js

@@ -25,6 +25,13 @@ import validateHookName from './validateHookName.js';

var handlers = void 0;
if (hooks[hookName]) {
handlers = hooks[hookName].handlers;
if (!hooks[hookName]) {
hooks[hookName] = {
handlers: [],
runs: 0
};
}
hooks[hookName].runs++;
handlers = hooks[hookName].handlers;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -51,3 +58,2 @@ args[_key - 1] = arguments[_key];

}
hooks[hookName].runs++;

@@ -54,0 +60,0 @@ while (hookInfo.currentIndex < handlers.length) {

@@ -35,6 +35,13 @@ 'use strict';

var handlers = void 0;
if (hooks[hookName]) {
handlers = hooks[hookName].handlers;
if (!hooks[hookName]) {
hooks[hookName] = {
handlers: [],
runs: 0
};
}
hooks[hookName].runs++;
handlers = hooks[hookName].handlers;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -61,3 +68,2 @@ args[_key - 1] = arguments[_key];

}
hooks[hookName].runs++;

@@ -64,0 +70,0 @@ while (hookInfo.currentIndex < handlers.length) {

{
"name": "@wordpress/hooks",
"version": "1.1.8",
"version": "1.2.0",
"description": "WordPress Hooks library",

@@ -5,0 +5,0 @@ "author": "WordPress",

@@ -25,6 +25,13 @@ import validateHookName from './validateHookName.js';

let handlers;
if ( hooks[ hookName ] ) {
handlers = hooks[ hookName ].handlers;
if ( ! hooks[ hookName ] ) {
hooks[ hookName ] = {
handlers: [],
runs: 0,
};
}
hooks[ hookName ].runs++;
handlers = hooks[ hookName ].handlers;
if ( ! handlers || ! handlers.length ) {

@@ -49,3 +56,2 @@ return returnFirstArg

}
hooks[ hookName ].runs++;

@@ -52,0 +58,0 @@ while ( hookInfo.currentIndex < handlers.length ) {

@@ -497,2 +497,12 @@ /* eslint-disable no-console */

// Verify an action with no handlers is still counted
expect( didAction( 'unattached.action' ) ).toBe( 0 );
doAction( 'unattached.action' );
expect( doingAction( 'unattached.action' ) ).toBe( false );
expect( didAction( 'unattached.action' ) ).toBe( 1 );
doAction( 'unattached.action' );
expect( doingAction( 'unattached.action' ) ).toBe( false );
expect( didAction( 'unattached.action' ) ).toBe( 2 );
// Verify hasAction returns 0 when no matching action.

@@ -499,0 +509,0 @@ expect( hasAction( 'notatest.action' ) ).toBe( false );

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