@wordpress/hooks
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -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 @@ } |
{ | ||
"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 @@ } ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69863
1872