This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _URL(url) { | |
// Naive URL parser. Assumes the input URL is valid. | |
this.hash = ""; | |
this.search = ""; | |
this.pathname = ""; | |
this.port = ""; | |
this.hostname = ""; | |
this.host = ""; | |
this.password = ""; | |
this.username = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.equals = function(o) { | |
var properties = Object.keys(this); | |
var eq = JSON.stringify(properties.sort()) === JSON.stringify(Object.keys(o).sort()); | |
while (eq && properties.length) { | |
var p = properties.pop(); | |
eq = this[p] === o[p]; | |
} | |
return eq; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function formatDate(date, format, utc) | |
{ | |
var MMMM = ["\x00", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
var MMM = ["\x01", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; | |
var dddd = ["\x02", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | |
var ddd = ["\x03", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; | |
function ii(i, len) { var s = i + ""; len = len || 2; while (s.length < len) s = "0" + s; return s; } | |
var y = utc ? date.getUTCFullYear() : date.getFullYear(); | |
format = format.replace(/(^|[^\\])yyyy+/g, "$1" + y); |