127 lines
13 KiB
JavaScript
127 lines
13 KiB
JavaScript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Timestring = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var Timestring = (function () {
|
|
function Timestring() {
|
|
var settings = arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
_classCallCheck(this, Timestring);
|
|
|
|
var DEFAULT_SETTINGS = {
|
|
hoursPerDay: 24,
|
|
daysPerWeek: 7,
|
|
weeksPerMonth: 4,
|
|
monthsPerYear: 12
|
|
};
|
|
|
|
// merge default settings with user settings
|
|
this.settings = DEFAULT_SETTINGS;
|
|
for (var s in settings) {
|
|
this.settings[s] = settings[s];
|
|
}
|
|
|
|
// time units
|
|
this.units = {
|
|
s: ["s", "sec", "secs", "second", "seconds"],
|
|
m: ["m", "min", "mins", "minute", "minutes"],
|
|
h: ["h", "hr", "hrs", "hour", "hours"],
|
|
d: ["d", "day", "days"],
|
|
w: ["w", "week", "weeks"],
|
|
mth: ["mth", "mths", "month", "months"],
|
|
y: ["y", "yr", "yrs", "year", "years"]
|
|
};
|
|
|
|
// time unit seconds mappings
|
|
this.unitValues = {
|
|
s: 1,
|
|
m: 60,
|
|
h: 3600
|
|
};
|
|
|
|
// dynamic time unit seconds mappings
|
|
// these are dynamic based on the settings
|
|
this.unitValues.d = this.settings.hoursPerDay * this.unitValues.h;
|
|
this.unitValues.w = this.settings.daysPerWeek * this.unitValues.d;
|
|
this.unitValues.mth = this.settings.weeksPerMonth * this.unitValues.w;
|
|
this.unitValues.y = this.settings.monthsPerYear * this.unitValues.mth;
|
|
}
|
|
|
|
_createClass(Timestring, [{
|
|
key: "parse",
|
|
value: function parse(string) {
|
|
var _this = this;
|
|
|
|
var returnUnit = arguments[1] === undefined ? "s" : arguments[1];
|
|
|
|
// get unit key helper
|
|
var getUnitKey = function getUnitKey(unit) {
|
|
for (var k in _this.units) {
|
|
for (var u in _this.units[k]) {
|
|
if (unit === _this.units[k][u]) {
|
|
return k;
|
|
}
|
|
}
|
|
}
|
|
|
|
// throw error if invalid unit was passed
|
|
throw new Error("The unit [" + unit + "] is not supported by timestring");
|
|
};
|
|
|
|
// convert a value to a specific unit
|
|
var convert = function convert(value, unit) {
|
|
var baseValue = _this.unitValues[getUnitKey(unit)];
|
|
|
|
return value / baseValue;
|
|
};
|
|
|
|
// get a value in seconds based on a specific unit
|
|
var getSeconds = function getSeconds(value, unit) {
|
|
var baseValue = _this.unitValues[getUnitKey(unit)];
|
|
|
|
return value * baseValue;
|
|
};
|
|
|
|
// seconds counter
|
|
var totalSeconds = 0;
|
|
|
|
// split string into groups and get total seconds for each group
|
|
var groups = string.toLowerCase() // convert words to lower case
|
|
.replace(/[^\.\w+-]+/g, "") // remove white space
|
|
.match(/[-+]?[0-9]+[a-z]+/g); // match time groups (digit followed by time unit - i.e 5d 15m = 2 time groups)
|
|
|
|
if (groups !== null) {
|
|
for (var group in groups) {
|
|
var g = groups[group];
|
|
var value = g.match(/[0-9]+/g)[0];
|
|
var unit = g.match(/[a-z]+/g)[0];
|
|
|
|
totalSeconds += getSeconds(value, unit);
|
|
}
|
|
}
|
|
|
|
return convert(totalSeconds, returnUnit);
|
|
}
|
|
}]);
|
|
|
|
return Timestring;
|
|
})();
|
|
|
|
exports["default"] = Timestring;
|
|
|
|
String.prototype.parseTime = function (unit, settings) {
|
|
return new Timestring(settings).parse(this, unit);
|
|
};
|
|
module.exports = exports["default"];
|
|
|
|
},{}]},{},[1])(1)
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJUaW1lc3RyaW5nLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7OztJQ0FBLFVBQUE7QUFDQSxXQURBLFVBQUEsR0FDQTtRQUFBLFFBQUEsZ0NBQUEsRUFBQTs7MEJBREEsVUFBQTs7QUFFQSxRQUFBLGdCQUFBLEdBQUE7QUFDQSxpQkFBQSxFQUFBLEVBQUE7QUFDQSxpQkFBQSxFQUFBLENBQUE7QUFDQSxtQkFBQSxFQUFBLENBQUE7QUFDQSxtQkFBQSxFQUFBLEVBQUE7S0FDQSxDQUFBOzs7QUFHQSxRQUFBLENBQUEsUUFBQSxHQUFBLGdCQUFBLENBQUE7QUFDQSxTQUFBLElBQUEsQ0FBQSxJQUFBLFFBQUEsRUFBQTtBQUFBLFVBQUEsQ0FBQSxRQUFBLENBQUEsQ0FBQSxDQUFBLEdBQUEsUUFBQSxDQUFBLENB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