timestring/dist/timestring.min.js

2 lines
29 KiB
JavaScript
Raw Normal View History

2015-05-05 11:31:15 +02:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Timestring=e()}}(function(){return function e(t,n,r){function i(u,o){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!o&&a)return a(u,!0);if(s)return s(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var h=n[u]={exports:{}};t[u][0].call(h.exports,function(e){var n=t[u][1][e];return i(n?n:e)},h,h.exports,e,t,n,r)}return n[u].exports}for(var s="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(){function e(){var t=void 0===arguments[0]?{}:arguments[0];r(this,e);var n={hoursPerDay:24,daysPerWeek:7,weeksPerMonth:4,monthsPerYear:12};this.settings=n;for(var i in t)this.settings[i]=t[i];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"]},this.unitValues={s:1,m:60,h:3600},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}return i(e,[{key:"parse",value:function(e){var t=this,n=void 0===arguments[1]?"s":arguments[1],r=function(e){for(var n in t.units)for(var r in t.units[n])if(e===t.units[n][r])return n;throw new Error("The unit ["+e+"] is not supported by timestring")},i=function(e,n){var i=t.unitValues[r(n)];return e/i},s=function(e,n){var i=t.unitValues[r(n)];return e*i},u=0,o=e.toLowerCase().replace(/[^\.\w+-]+/g,"").match(/[-+]?[0-9]+[a-z]+/g);if(null!==o)for(var a in o){var f=o[a],h=f.match(/[0-9]+/g)[0],l=f.match(/[a-z]+/g)[0];u+=s(h,l)}return i(u,n)}}]),e}();n["default"]=s,String.prototype.parseTime=function(e,t){return new s(t).parse(this,e)},t.exports=n["default"]},{}]},{},[1])(1)});
2015-05-05 12:05:24 +02:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJ0aW1lc3RyaW5nLmpzIiwiVGltZXN0cmluZy5qcyJdLCJuYW1lcyI6WyJmIiwiZXhwb3J0cyIsIm1vZHVsZSIsImRlZmluZSIsImFtZCIsImciLCJ3aW5kb3ciLCJnbG9iYWwiLCJzZWxmIiwidGhpcyIsIlRpbWVzdHJpbmciLCJlIiwidCIsIm4iLCJyIiwicyIsIm8iLCJ1IiwiYSIsInJlcXVpcmUiLCJpIiwiRXJyb3IiLCJjb2RlIiwibCIsImNhbGwiLCJsZW5ndGgiLDEsIl9jbGFzc0NhbGxDaGVjayIsImluc3RhbmNlIiwiQ29uc3RydWN0b3IiLCJUeXBlRXJyb3IiLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsInZhbHVlIiwiX2NyZWF0ZUNsYXNzIiwiZGVmaW5lUHJvcGVydGllcyIsInRhcmdldCIsInByb3BzIiwiZGVzY3JpcHRvciIsImVudW1lcmFibGUiLCJjb25maWd1cmFibGUiLCJ3cml0YWJsZSIsImtleSIsInByb3RvUHJvc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