@cjser/leap-year 4.0.0-cjser.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/@cjser/leap-year.tmp-26-1778153251295/index.js
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ default: () => isLeapYear
23
+ });
24
+ module.exports = __toCommonJS(index_exports);
25
+ function isLeapYear(year = /* @__PURE__ */ new Date()) {
26
+ if (!(year instanceof Date) && typeof year !== "number") {
27
+ throw new TypeError(`Expected \`year\` to be of type \`Date\` or \`number\`, got \`${typeof year}\``);
28
+ }
29
+ year = year instanceof Date ? year.getFullYear() : year;
30
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
31
+ }
package/index.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ Check if a year is a [leap year](https://en.wikipedia.org/wiki/Leap_year).
3
+
4
+ @param year - Default: `new Date()`.
5
+
6
+ @example
7
+ ```
8
+ import leapYear from '@cjser/leap-year';
9
+
10
+ leapYear(2014);
11
+ //=> false
12
+
13
+ leapYear(2016);
14
+ //=> true
15
+ ```
16
+ */
17
+ export default function isLeapYear(year?: number | Date): boolean;
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export default function isLeapYear(year = new Date()) {
2
+ if (!(year instanceof Date) && typeof year !== 'number') {
3
+ throw new TypeError(`Expected \`year\` to be of type \`Date\` or \`number\`, got \`${typeof year}\``);
4
+ }
5
+
6
+ year = year instanceof Date ? year.getFullYear() : year;
7
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
8
+ }
package/license ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@cjser/leap-year",
3
+ "version": "4.0.0-cjser.2",
4
+ "description": "Check if a year is a leap year",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://code.moenext.com/3rdeye/cjser.git"
9
+ },
10
+ "funding": "https://github.com/sponsors/sindresorhus",
11
+ "author": {
12
+ "name": "Sindre Sorhus",
13
+ "email": "sindresorhus@gmail.com",
14
+ "url": "https://sindresorhus.com"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ "require": "./dist-cjser/index.cjs",
19
+ "default": "./index.js"
20
+ },
21
+ "engines": {
22
+ "node": ">=12"
23
+ },
24
+ "scripts": {
25
+ "test": "xo && ava && tsd"
26
+ },
27
+ "files": [
28
+ "index.js",
29
+ "index.d.ts",
30
+ "dist-cjser"
31
+ ],
32
+ "keywords": [
33
+ "leap",
34
+ "year",
35
+ "date"
36
+ ],
37
+ "devDependencies": {
38
+ "ava": "^3.15.0",
39
+ "tsd": "^0.14.0",
40
+ "xo": "^0.38.2"
41
+ },
42
+ "main": "./dist-cjser/index.cjs",
43
+ "cjser": {
44
+ "sourceVersion": "4.0.0",
45
+ "cjserVersion": 2,
46
+ "original": {
47
+ "name": "leap-year",
48
+ "version": "4.0.0",
49
+ "exports": "./index.js",
50
+ "repository": "sindresorhus/leap-year",
51
+ "files": [
52
+ "index.js",
53
+ "index.d.ts"
54
+ ],
55
+ "scripts": {
56
+ "test": "xo && ava && tsd"
57
+ }
58
+ }
59
+ }
60
+ }
package/readme.md ADDED
@@ -0,0 +1,42 @@
1
+ # leap-year
2
+
3
+ > Check if a year is a [leap year](https://en.wikipedia.org/wiki/Leap_year)
4
+
5
+ ## Install
6
+
7
+ ```
8
+ $ npm install leap-year
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import isLeapYear from 'leap-year';
15
+
16
+ isLeapYear(2014);
17
+ //=> false
18
+
19
+ isLeapYear(2016);
20
+ //=> true
21
+ ```
22
+
23
+ ## API
24
+
25
+ ### isLeapYear(year?)
26
+
27
+ #### year
28
+
29
+ Type: `number`\
30
+ Default: Current year
31
+
32
+ ### isLeapYear(date?)
33
+
34
+ #### date
35
+
36
+ Type: `Date`
37
+ Default: `new Date()`
38
+
39
+ ## cjser
40
+
41
+ This package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
42
+ Original repository: https://github.com/sindresorhus/leap-year