Comparing version 2.1.0 to 3.0.0
'use strict'; | ||
const isDefined = x => x !== null && x !== undefined; | ||
const isDefined = value => value !== undefined; | ||
module.exports = (month, year) => { | ||
module.exports = ({month, year} = {}) => { | ||
if (isDefined(month) && typeof month !== 'number') { | ||
@@ -6,0 +6,0 @@ throw new TypeError(`Expected \`month\` to be of type \`number\`, got \`${typeof month}\``); |
{ | ||
"name": "month-days", | ||
"version": "2.1.0", | ||
"description": "Get the number of days in a month", | ||
"license": "MIT", | ||
"repository": "sindresorhus/month-days", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"month", | ||
"days", | ||
"year", | ||
"date", | ||
"utc", | ||
"number", | ||
"count" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "month-days", | ||
"version": "3.0.0", | ||
"description": "Get the number of days in a month", | ||
"license": "MIT", | ||
"repository": "sindresorhus/month-days", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"month", | ||
"days", | ||
"year", | ||
"date", | ||
"utc", | ||
"number", | ||
"count" | ||
], | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # month-days [](https://travis-ci.org/sindresorhus/month-days) | ||
``` | ||
$ npm install --save month-days | ||
$ npm install month-days | ||
``` | ||
@@ -19,3 +19,3 @@ | ||
monthDays(1, 2016); | ||
monthDays({month: 1, year: 2016}); | ||
//=> 29 | ||
@@ -27,6 +27,10 @@ ``` | ||
### monthDays([month], [year]) | ||
### monthDays([options]) | ||
#### month | ||
#### options | ||
Type: `object` | ||
##### month | ||
Type: `number`<br> | ||
@@ -37,3 +41,3 @@ Default: Current UTC month | ||
#### year | ||
##### year | ||
@@ -40,0 +44,0 @@ Type: `number`<br> |
Sorry, the diff of this file is not supported yet
3474
5
38
47
3