UNPKG

@stdlib/esm

Version:

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

3 lines 1.17 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import r from"./../assert/is-date-object.js";import e from"./../assert/is-string.js";import t from"./../assert/is-integer.js";import i from"./day-of-year.js";import a from"./quarter-of-year.js";import n from"./../assert/is-leap-year.js";var o=r,s=e.isPrimitive,m=t.isPrimitive,u=i,g=a,l=n,f=[0,90,181,273],p=[0,91,182,274];function d(r,e,t){var i,a,n,d;if(0===arguments.length)i=new Date,n=g(i),d=u(i),a=i.getFullYear();else if(1===arguments.length){if(!o(r))throw new TypeError("invalid argument. If only providing a single argument, must provide a `Date` object. Value: `"+r+"`.");n=g(i=r),d=u(i),a=i.getFullYear()}else{if(!s(r)&&!m(r))throw new TypeError("invalid argument. First argument must be either a string or integer. Value: `"+r+"`.");if(!m(e))throw new TypeError("invalid argument. Second argument must be an integer. Value: `"+e+"`.");if(!m(t))throw new TypeError("invalid argument. Third argument must be an integer. Value: `"+t+"`.");n=g(r),d=u(r,e,t),a=t}return l(a)?d-p[n-1]:d-f[n-1]}var v=d;export default v; //# sourceMappingURL=day-of-quarter.js.map