├── .eslintignore ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .npmignore ├── .npmrc ├── .travis.yml ├── LICENSE ├── README.md ├── package.json ├── src └── index.js ├── test └── index.js ├── tsconfig.json ├── tslint.json └── typings └── index.d.ts /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | docs/* 3 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "parserOptions": { 4 | "ecmaVersion": 2018 5 | }, 6 | "env": { 7 | "es6": true, 8 | "node": true 9 | }, 10 | "rules": { 11 | "strict": ["error", "global"], 12 | "no-await-in-loop": "warn", 13 | "no-compare-neg-zero": "error", 14 | "no-extra-parens": ["warn", "all", { 15 | "nestedBinaryExpressions": false 16 | }], 17 | "no-template-curly-in-string": "error", 18 | "no-unsafe-negation": "error", 19 | "valid-jsdoc": ["error", { 20 | "requireReturn": false, 21 | "requireReturnDescription": false, 22 | "prefer": { 23 | "return": "returns", 24 | "arg": "param" 25 | }, 26 | "preferType": { 27 | "String": "string", 28 | "Number": "number", 29 | "Boolean": "boolean", 30 | "Symbol": "symbol", 31 | "object": "Object", 32 | "function": "Function", 33 | "array": "Array", 34 | "date": "Date", 35 | "error": "Error", 36 | "null": "void" 37 | } 38 | }], 39 | 40 | "accessor-pairs": "warn", 41 | "array-callback-return": "error", 42 | "complexity": "warn", 43 | "consistent-return": "error", 44 | "curly": ["error", "multi-line", "consistent"], 45 | "dot-location": ["error", "property"], 46 | "dot-notation": "error", 47 | "eqeqeq": "error", 48 | "no-empty-function": "error", 49 | "no-floating-decimal": "error", 50 | "no-implied-eval": "error", 51 | "no-invalid-this": "error", 52 | "no-lone-blocks": "error", 53 | "no-multi-spaces": "error", 54 | "no-new-func": "error", 55 | "no-new-wrappers": "error", 56 | "no-new": "error", 57 | "no-octal-escape": "error", 58 | "no-return-assign": "error", 59 | "no-return-await": "error", 60 | "no-self-compare": "error", 61 | "no-sequences": "error", 62 | "no-throw-literal": "error", 63 | "no-unmodified-loop-condition": "error", 64 | "no-unused-expressions": "error", 65 | "no-useless-call": "error", 66 | "no-useless-concat": "error", 67 | "no-useless-escape": "error", 68 | "no-useless-return": "error", 69 | "no-void": "error", 70 | "no-warning-comments": "warn", 71 | "prefer-promise-reject-errors": "error", 72 | "require-await": "warn", 73 | "wrap-iife": "error", 74 | "yoda": "error", 75 | 76 | "no-label-var": "error", 77 | "no-shadow": "error", 78 | "no-undef-init": "error", 79 | 80 | "callback-return": "error", 81 | "getter-return": "off", 82 | "handle-callback-err": "error", 83 | "no-mixed-requires": "error", 84 | "no-new-require": "error", 85 | "no-path-concat": "error", 86 | 87 | "array-bracket-spacing": "error", 88 | "block-spacing": "error", 89 | "brace-style": ["error", "1tbs", { "allowSingleLine": true }], 90 | "capitalized-comments": ["error", "always", { "ignoreConsecutiveComments": true }], 91 | "comma-dangle": ["error", "always-multiline"], 92 | "comma-spacing": "error", 93 | "comma-style": "error", 94 | "computed-property-spacing": "error", 95 | "consistent-this": ["error", "$this"], 96 | "eol-last": "error", 97 | "func-names": "error", 98 | "func-name-matching": "error", 99 | "func-style": ["error", "declaration", { "allowArrowFunctions": true }], 100 | "indent": ["error", 2, { "SwitchCase": 1 }], 101 | "key-spacing": "error", 102 | "keyword-spacing": "error", 103 | "max-depth": "error", 104 | "max-len": ["error", 120, 2], 105 | "max-nested-callbacks": ["error", { "max": 4 }], 106 | "max-statements-per-line": ["error", { "max": 2 }], 107 | "new-cap": "off", 108 | "newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }], 109 | "no-array-constructor": "error", 110 | "no-inline-comments": "error", 111 | "no-lonely-if": "error", 112 | "no-mixed-operators": "error", 113 | "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], 114 | "no-new-object": "error", 115 | "no-spaced-func": "error", 116 | "no-trailing-spaces": "error", 117 | "no-unneeded-ternary": "error", 118 | "no-whitespace-before-property": "error", 119 | "nonblock-statement-body-position": "error", 120 | "object-curly-spacing": ["error", "always"], 121 | "operator-assignment": "error", 122 | "operator-linebreak": ["error", "after"], 123 | "padded-blocks": ["error", "never"], 124 | "quote-props": ["error", "as-needed"], 125 | "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }], 126 | "semi-spacing": "error", 127 | "semi": "error", 128 | "space-before-blocks": "error", 129 | "space-before-function-paren": ["error", { 130 | "anonymous": "never", 131 | "named": "never", 132 | "asyncArrow": "always" 133 | }], 134 | "space-in-parens": "error", 135 | "space-infix-ops": "error", 136 | "space-unary-ops": "error", 137 | "spaced-comment": "error", 138 | "template-tag-spacing": "error", 139 | "unicode-bom": "error", 140 | 141 | "arrow-body-style": "error", 142 | "arrow-parens": ["error", "as-needed"], 143 | "arrow-spacing": "error", 144 | "no-duplicate-imports": "error", 145 | "no-useless-computed-key": "error", 146 | "no-useless-constructor": "error", 147 | "prefer-arrow-callback": "error", 148 | "prefer-numeric-literals": "error", 149 | "prefer-rest-params": "error", 150 | "prefer-spread": "error", 151 | "prefer-template": "error", 152 | "rest-spread-spacing": "error", 153 | "template-curly-spacing": "error", 154 | "yield-star-spacing": "error" 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Packages 2 | node_modules/ 3 | yarn.lock 4 | package-lock.json 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Packages 2 | node_modules/ 3 | yarn.lock 4 | package-lock.json 5 | 6 | # Deploy 7 | docs/ 8 | test/ 9 | .github/ 10 | 11 | # License 12 | LICENSE.txt 13 | 14 | # Typescript 15 | tsconfig.json 16 | tslint.json 17 | 18 | # Other 19 | .npmrc 20 | .gitignore 21 | .gitattributes 22 | .eslintrc.json 23 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 10 4 | - 11 5 | install: npm install 6 | cache: 7 | directories: 8 | - node_modules 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Aiden Bai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # is-monday 2 | [![Version](https://img.shields.io/npm/v/is-monday.svg?maxAge=3600)](https://www.npmjs.com/package/is-monday) 3 | 4 | Checks if it is monday (the worst day) 5 | 6 | ## Install 7 | 8 | ```bash 9 | npm i -s is-monday 10 | ``` 11 | 12 | ## Usage 13 | 14 | ```js 15 | const monday = require('is-monday'); 16 | 17 | monday(); // returns boolean. 18 | ``` -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "is-monday", 3 | "version": "0.0.1", 4 | "description": "Checks if it is monday.", 5 | "main": "./src/index", 6 | "types": "./typings/index.d.ts", 7 | "scripts": { 8 | "test": "npm run lint", 9 | "lint": "eslint src *.js", 10 | "lint:fix": "eslint --fix src", 11 | "lint:typings": "tslint typings/index.d.ts" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/cringiest/is-monday.git" 16 | }, 17 | "keywords": ["monday", "util", "fun"], 18 | "author": "Aiden Bai ", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/cringiest/is-monday/issues" 22 | }, 23 | "homepage": "https://github.com/cringiest/is-monday", 24 | "devDependencies": { 25 | "@types/node": "^10.7.1", 26 | "eslint": "^5.4.0", 27 | "tslint": "^5.11.0", 28 | "tslint-config-typings": "^0.3.1", 29 | "typescript": "^3.0.1" 30 | }, 31 | "engines": { 32 | "node": ">=8.0.0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | module.exports = (timeZoneOffset = 0) => { 2 | const date = new Date(); 3 | date.setUTCHours(timeZoneOffset); 4 | return date.getDay() === 1; 5 | }; -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | const isMonday= require('./../src/index'); 2 | 3 | test('returns if today is tuesday', () => { 4 | const day = new Date().getDay(); 5 | expect(isMonday()).toEqual(day === 2); 6 | }); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "strictNullChecks": true, 7 | "noEmit": true, 8 | "forceConsistentCasingInFileNames": true 9 | }, 10 | "files": [ 11 | "typings/index.d.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "tslint-config-typings" 4 | ], 5 | "rules": { 6 | "class-name": true, 7 | "comment-format": [ 8 | true, 9 | "check-space" 10 | ], 11 | "indent": [ 12 | true, 13 | "tabs" 14 | ], 15 | "no-duplicate-variable": true, 16 | "no-unused-variable": [false], 17 | "no-eval": true, 18 | "no-internal-module": true, 19 | "no-trailing-whitespace": true, 20 | "no-unsafe-finally": true, 21 | "no-var-keyword": true, 22 | "one-line": [ 23 | true, 24 | "check-open-brace", 25 | "check-whitespace" 26 | ], 27 | "quotemark": [ 28 | true, 29 | "single" 30 | ], 31 | "semicolon": [ 32 | true, 33 | "always" 34 | ], 35 | "triple-equals": [ 36 | true, 37 | "allow-null-check" 38 | ], 39 | "typedef-whitespace": [ 40 | true, 41 | { 42 | "call-signature": "nospace", 43 | "index-signature": "nospace", 44 | "parameter": "nospace", 45 | "property-declaration": "nospace", 46 | "variable-declaration": "nospace" 47 | } 48 | ], 49 | "variable-name": [ 50 | true, 51 | "ban-keywords" 52 | ], 53 | "whitespace": [ 54 | true, 55 | "check-branch", 56 | "check-decl", 57 | "check-operator", 58 | "check-separator", 59 | "check-type" 60 | ] 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | declare function isMonday(offset?: number): boolean; 2 | 3 | export = isMonday; --------------------------------------------------------------------------------