Skip to content

Commit 9ea2995

Browse files
author
Alexander Belov
committed
Fixes
1 parent 57ce8f0 commit 9ea2995

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/math/is-power-of-two/is-power-of-two.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
* @returns {boolean}
66
*/
77
export function isPowerOfTwo(value: number): boolean {
8-
return (value & (value - 1)) === 0;
8+
return value && !(value & (value - 1));
99
}

0 commit comments

Comments
 (0)