Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,7 @@
"use strict";
var getTime = Date.prototype.getTime;
module.exports = function () {
return new Date(getTime.call(this));
};

View File

@@ -0,0 +1,17 @@
"use strict";
var getMonth = Date.prototype.getMonth;
module.exports = function () {
switch (getMonth.call(this)) {
case 1:
return this.getFullYear() % 4 ? 28 : 29;
case 3:
case 5:
case 8:
case 10:
return 30;
default:
return 31;
}
};

View File

@@ -0,0 +1,8 @@
"use strict";
var setHours = Date.prototype.setHours;
module.exports = function () {
setHours.call(this, 0, 0, 0, 0);
return this;
};

View File

@@ -0,0 +1,8 @@
"use strict";
var floorDay = require("./floor-day");
module.exports = function () {
floorDay.call(this).setDate(1);
return this;
};

View File

@@ -0,0 +1,8 @@
"use strict";
var floorMonth = require("./floor-month");
module.exports = function () {
floorMonth.call(this).setMonth(0);
return this;
};

View File

@@ -0,0 +1,38 @@
/* eslint id-length: "off" */
"use strict";
var pad = require("../../number/#/pad")
, date = require("../valid-date")
, format;
format = require("../../string/format-method")({
Y: function () {
return String(this.getFullYear());
},
y: function () {
return String(this.getFullYear()).slice(-2);
},
m: function () {
return pad.call(this.getMonth() + 1, 2);
},
d: function () {
return pad.call(this.getDate(), 2);
},
H: function () {
return pad.call(this.getHours(), 2);
},
M: function () {
return pad.call(this.getMinutes(), 2);
},
S: function () {
return pad.call(this.getSeconds(), 2);
},
L: function () {
return pad.call(this.getMilliseconds(), 3);
}
});
module.exports = function (pattern) {
return format.call(date(this), pattern);
};

View File

@@ -0,0 +1,10 @@
"use strict";
module.exports = {
copy: require("./copy"),
daysInMonth: require("./days-in-month"),
floorDay: require("./floor-day"),
floorMonth: require("./floor-month"),
floorYear: require("./floor-year"),
format: require("./format")
};

View File

@@ -0,0 +1,7 @@
"use strict";
module.exports = {
"#": require("./#"),
"isDate": require("./is-date"),
"validDate": require("./valid-date")
};

View File

@@ -0,0 +1,7 @@
"use strict";
var objToString = Object.prototype.toString, id = objToString.call(new Date());
module.exports = function (value) {
return (value && (value instanceof Date || objToString.call(value) === id)) || false;
};

View File

@@ -0,0 +1,8 @@
"use strict";
var isDate = require("./is-date");
module.exports = function (value) {
if (!isDate(value) || isNaN(value)) throw new TypeError(value + " is not valid Date object");
return value;
};