Socket
Socket
Sign inDemoInstall

@wordpress/hooks

Package Overview
Dependencies
Maintainers
5
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.6 to 1.1.7

5

build-module/createHasHook.js

@@ -16,7 +16,6 @@ /**

*
* @return {number} The number of handlers that are attached to
* the given hook.
* @return {boolean} Whether there are handlers that are attached to the given hook.
*/
return function hasHook(hookName) {
return hooks[hookName] ? hooks[hookName].handlers.length : 0;
return hookName in hooks;
};

@@ -23,0 +22,0 @@ }

@@ -21,7 +21,6 @@ "use strict";

*
* @return {number} The number of handlers that are attached to
* the given hook.
* @return {boolean} Whether there are handlers that are attached to the given hook.
*/
return function hasHook(hookName) {
return hooks[hookName] ? hooks[hookName].handlers.length : 0;
return hookName in hooks;
};

@@ -28,0 +27,0 @@ }

2

package.json
{
"name": "@wordpress/hooks",
"version": "1.1.6",
"version": "1.1.7",
"description": "WordPress Hooks library",

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

@@ -16,9 +16,6 @@ /**

*
* @return {number} The number of handlers that are attached to
* the given hook.
* @return {boolean} Whether there are handlers that are attached to the given hook.
*/
return function hasHook( hookName ) {
return hooks[ hookName ]
? hooks[ hookName ].handlers.length
: 0;
return hookName in hooks;
};

@@ -25,0 +22,0 @@ }

@@ -457,3 +457,3 @@ /* eslint-disable no-console */

expect( didAction( 'test.action' ) ).toBe( 0 );
expect( hasAction( 'test.action' ) ).toBe( 0 );
expect( hasAction( 'test.action' ) ).toBe( false );

@@ -470,3 +470,3 @@ addAction( 'test.action', 'my_callback', () => {

expect( didAction( 'test.action' ) ).toBe( 0 );
expect( hasAction( 'test.action' ) ).toBe( 1 );
expect( hasAction( 'test.action' ) ).toBe( true );

@@ -479,3 +479,3 @@ doAction( 'test.action' );

expect( didAction( 'test.action' ) ).toBe( 1 );
expect( hasAction( 'test.action' ) ).toBe( 1 );
expect( hasAction( 'test.action' ) ).toBe( true );
expect( doingAction() ).toBe( false );

@@ -495,3 +495,3 @@ expect( doingAction( 'test.action' ) ).toBe( false );

expect( didAction( 'test.action' ) ).toBe( 2 );
expect( hasAction( 'test.action' ) ).toBe( 0 );
expect( hasAction( 'test.action' ) ).toBe( true );

@@ -502,3 +502,3 @@ doAction( 'another.action' );

// Verify hasAction returns 0 when no matching action.
expect( hasAction( 'notatest.action' ) ).toBe( 0 );
expect( hasAction( 'notatest.action' ) ).toBe( false );
} );

@@ -522,4 +522,4 @@

expect( didFilter( 'runtest.filter' ) ).toBe( 1 );
expect( hasFilter( 'runtest.filter' ) ).toBe( 1 );
expect( hasFilter( 'notatest.filter' ) ).toBe( 0 );
expect( hasFilter( 'runtest.filter' ) ).toBe( true );
expect( hasFilter( 'notatest.filter' ) ).toBe( false );
expect( doingFilter() ).toBe( false );

@@ -532,3 +532,3 @@ expect( doingFilter( 'runtest.filter' ) ).toBe( false );

expect( hasFilter( 'runtest.filter' ) ).toBe( 0 );
expect( hasFilter( 'runtest.filter' ) ).toBe( true );
expect( didFilter( 'runtest.filter' ) ).toBe( 1 );

@@ -535,0 +535,0 @@ } );

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