UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 1.76 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import e from"./../assert/is-date-object.js";import r from"./../assert/is-string.js";import t from"./../assert/is-integer.js";import i from"./../string/lowercase.js";import a from"./../assert/is-leap-year.js";import n from"./../constants/time/hours-in-day.js";var o=744,s=744,m=672,u=672,g=744,l=744,f=720,h=720,p=744,v=720,d=720,j=744,w=744,b=744,c=744,y=720,E=720,F=744,V=744,D=720,M=720,T=744,Y=744,P={1:744,2:672,3:744,4:720,5:744,6:720,7:744,8:744,9:720,10:744,11:720,12:744,jan:o,january:s,feb:m,february:u,mar:g,march:l,apr:f,april:h,may:p,jun:v,june:d,jul:j,july:w,aug:b,august:c,sep:y,september:E,oct:F,october:V,nov:D,november:M,dec:T,december:Y},S=e,x=r.isPrimitive,z=t.isPrimitive,A=i,R=a,k=n,q=P;function B(e,r){var t,i,a,n;if(0===arguments.length)i=(n=new Date).getMonth()+1,a=n.getFullYear();else if(1===arguments.length)if(S(e))i=(n=e).getMonth()+1,a=n.getFullYear();else{if(!x(e)&&!z(e))throw new TypeError("invalid argument. First argument must be either a string, integer, or `Date` object. Value: `"+e+"`.");a=(new Date).getFullYear(),i=e}else{if(!x(e)&&!z(e))throw new TypeError("invalid argument. First argument must be either a string or integer. Value: `"+e+"`.");if(!z(r))throw new TypeError("invalid argument. Second argument must be an integer. Value: `"+r+"`.");i=e,a=r}if(z(i)&&(i<1||i>12))throw new RangeError("invalid argument. An integer month value must be on the interval `[1,12]`. Value: `"+i+"`.");if(i=A(i.toString()),void 0===(t=q[i]))throw new Error("invalid argument. Must provide a recognized month. Value: `"+i+"`.");return 672===t&&R(a)&&(t+=k),t}var C=B;export default C; //# sourceMappingURL=hours-in-month.js.map