All files / nanakshahi-js/lib/utils leapYear.js

100% Statements 2/2
66.66% Branches 2/3
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11                  25x  
/**
 * Check if current year is Leap Year (Gregorian Leap Rule)
 * Uses optimized version from: https://stackoverflow.com/a/11595914
 * @param {number} year Year to check for Leap
 * @return {boolean} True for Leap, False for Regular
 * @example leapYear()
 * @private
 */
// eslint-disable-next-line no-bitwise
module.exports = year => ( year & 3 ) === 0 && ( ( year % 25 ) !== 0 || ( year & 15 ) === 0 )