Created
March 31, 2019 03:39
-
-
Save elzup/e4415065a5ca144adf267609c35c5f82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const has31 = month => Boolean((month & 1) ^ ((month >> 3) & 1)) | |
test('1-12', () => { | |
expect(has31(1)).toMatchInlineSnapshot(`true`) | |
expect(has31(2)).toMatchInlineSnapshot(`false`) | |
expect(has31(3)).toMatchInlineSnapshot(`true`) | |
expect(has31(4)).toMatchInlineSnapshot(`false`) | |
expect(has31(5)).toMatchInlineSnapshot(`true`) | |
expect(has31(6)).toMatchInlineSnapshot(`false`) | |
expect(has31(7)).toMatchInlineSnapshot(`true`) | |
expect(has31(8)).toMatchInlineSnapshot(`true`) | |
expect(has31(9)).toMatchInlineSnapshot(`false`) | |
expect(has31(10)).toMatchInlineSnapshot(`true`) | |
expect(has31(11)).toMatchInlineSnapshot(`false`) | |
expect(has31(12)).toMatchInlineSnapshot(`true`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment