New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

self-timer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

self-timer - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

__tests__/check-es5-test.js

40

__tests__/at-es5-test.js

@@ -5,3 +5,3 @@ "use strict";

describe("SelfTimer.js *test group Test", () => {
describe("SelfTimer.js *at group Test", () => {
const _str = "working";

@@ -65,5 +65,3 @@

const callback = task.at().HoursBetween(0, 23, function() {
return _str;
});
const callback = task.at().HoursBetween(0, 23, () => _str);

@@ -81,8 +79,36 @@ expect(callback).toBe(_str);

const callback = task.at().HourSelects(hours, () => {
return _str;
});
const callback = task.at().HourSelects(hours, () => _str);
expect(callback).toBe(_str);
});
it("at().Min Test", () => {
const date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
const callback = task.at().Min(14, () => _str);
expect(callback).toBe(_str);
});
it("at().MinBetween Test", () => {
let date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
const callback = task.at().MinBetween(14, 17, () => _str);
expect(callback).toBe(_str);
});
it("at().MinSelects Test", () => {
let date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
const callback = task.at().MinSelects([14, 17], () => _str);
expect(callback).toBe(_str);
});
});

@@ -39,2 +39,35 @@ 'use strict'

it('SelfTimer at().Min Test', () => {
let date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
task.at(true)
.Min(14)
.then((res) => expect(res).toBeTruthy() )
.catch((res) => {});
});
it('SelfTimer at().MinBetween Test', () => {
let date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
task.at(true)
.MinBetween(14, 18)
.then((res) => expect(res).toBeTruthy() )
.catch((res) => {});
});
it('SelfTimer at().Selects Test', () => {
let date = new Date("Tue Oct 17 2017 17:14:12 GMT+0900 (JST)");
const task = new selfTimer(date);
task.at(true)
.MinSelects([14, 18])
.then((res) => expect(res).toBeTruthy() )
.catch((res) => {});
});
it('SelfTimer at().Hour Test', () => {

@@ -41,0 +74,0 @@

# self-timer.js Change log
## version 1.6.0 [ 2017/10/17 ]
- added `check()` method for **es5 (only callback)**
- added `at().Min()` method
- added `at().MinBetween` method
- added `at().MinSelects()` method
## version 1.5.3 [ 2017/06/12 ]

@@ -4,0 +10,0 @@ attached missing varidation in `is` method

@@ -253,2 +253,6 @@ !function(e){function n(){}function t(e,n){return function(){e.apply(n,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function i(e,n){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(n):(e._handled=!0,void o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null===t)return void(1===e._state?r:u)(n.promise,e._value);var o;try{o=t(e._value)}catch(i){return void u(n.promise,i)}r(n.promise,o)}))}function r(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var i=n.then;if(n instanceof o)return e._state=3,e._value=n,void f(e);if("function"==typeof i)return void s(t(i,n),e)}e._state=1,e._value=n,f(e)}catch(r){u(e,r)}}function u(e,n){e._state=2,e._value=n,f(e)}function f(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;n<t;n++)i(e,e._deferreds[n]);e._deferreds=null}function c(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}function s(e,n){var t=!1;try{e(function(e){t||(t=!0,r(n,e))},function(e){t||(t=!0,u(n,e))})}catch(o){if(t)return;t=!0,u(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var o=new this.constructor(n);return i(this,new c(e,t,o)),o},o.all=function(e){var n=Array.prototype.slice.call(e);return new o(function(e,t){function o(r,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var f=u.then;if("function"==typeof f)return void f.call(u,function(e){o(r,e)},t)}n[r]=u,0===--i&&e(n)}catch(c){t(c)}}if(0===n.length)return e([]);for(var i=n.length,r=0;r<n.length;r++)o(r,n[r])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(n,t){for(var o=0,i=e.length;o<i;o++)e[o].then(n,t)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},o._setImmediateFn=function(e){o._immediateFn=e},o._setUnhandledRejectionFn=function(e){o._unhandledRejectionFn=e},"undefined"!=typeof module&&module.exports?module.exports=o:e.Promise||(e.Promise=o)}(this);

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -288,3 +292,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -306,3 +310,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -572,2 +585,3 @@ is: [

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -640,3 +654,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -727,2 +816,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -729,0 +821,0 @@ HoursBetween: HoursBetween,

2

dist/selftimer-promise-polyfill.min.js

@@ -1,1 +0,1 @@

!function(e){function t(){}function r(e,t){return function(){e.apply(t,arguments)}}function n(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function o(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void n._immediateFn(function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null===r)return void(1===e._state?i:a)(t.promise,e._value);var n;try{n=r(e._value)}catch(e){return void a(t.promise,e)}i(t.promise,n)}))}function i(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var o=t.then;if(t instanceof n)return e._state=3,e._value=t,void u(e);if("function"==typeof o)return void c(r(o,t),e)}e._state=1,e._value=t,u(e)}catch(t){a(e,t)}}function a(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&n._immediateFn(function(){e._handled||n._unhandledRejectionFn(e._value)});for(var t=0,r=e._deferreds.length;t<r;t++)o(e,e._deferreds[t]);e._deferreds=null}function s(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function c(e,t){var r=!1;try{e(function(e){r||(r=!0,i(t,e))},function(e){r||(r=!0,a(t,e))})}catch(e){if(r)return;r=!0,a(t,e)}}var f=setTimeout;n.prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,r){var n=new this.constructor(t);return o(this,new s(e,r,n)),n},n.all=function(e){var t=Array.prototype.slice.call(e);return new n(function(e,r){function n(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,function(e){n(i,e)},r)}t[i]=a,0===--o&&e(t)}catch(e){r(e)}}if(0===t.length)return e([]);for(var o=t.length,i=0;i<t.length;i++)n(i,t[i])})},n.resolve=function(e){return e&&"object"==typeof e&&e.constructor===n?e:new n(function(t){t(e)})},n.reject=function(e){return new n(function(t,r){r(e)})},n.race=function(e){return new n(function(t,r){for(var n=0,o=e.length;n<o;n++)e[n].then(t,r)})},n._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){f(e,0)},n._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},n._setImmediateFn=function(e){n._immediateFn=e},n._setUnhandledRejectionFn=function(e){n._unhandledRejectionFn=e},"undefined"!=typeof module&&module.exports?module.exports=n:e.Promise||(e.Promise=n)}(this),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.SelfTimer=t()}(this,function(){"use strict";function e(e){if("undefined"==typeof e)this.D=new Date;else{if(e instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=e}}return e.prototype.helpers=function(){var e=this.D,t=(this.D.getDay(),function(e){return"function"==typeof e||void 0==e}),r=function(e,t){for(var r=e.length;r--;)if(e[r]===t)return!0;return!1},n=function(e,t){var r=!1;return e.indexOf(t)>=0&&(r=!0),r},o=function(e){return e.map(function(e){return e.replace(/Sun/g,0)}).map(function(e){return e.replace(/Mon/g,1)}).map(function(e){return e.replace(/Tue/g,2)}).map(function(e){return e.replace(/Wed/g,3)}).map(function(e){return e.replace(/Thu/g,4)}).map(function(e){return e.replace(/Fri/g,5)}).map(function(e){return e.replace(/Sat/g,6)}).map(function(e){return parseInt(e)})},i=function(e){var t=e.split(/:|\s/),r=new Date;return"pm"==t.pop().toLowerCase()&&(t[0]=+t[0]+12),r.setHours(+t.shift()),r.setMinutes(+t.shift()),r},a=function(e,t){1==arguments.length&&(t=e,e=0);for(var r=[],n=0;n<t;n++)r.push(e-n);return r},u=function(e,t,r){return r<t.setDate(t.getDate()+1)&&r>e},s=function(){var t=e.getMonth()+1,r=e.getDate();return t.length<2&&(t="0"+t),r.length<2&&(r="0"+r),[t,r].join("-")},c=function(e){var t;switch(e){case"s":case"sec":case"second":case"seconds":t=1e3;break;case"m":case"min":case"minute":case"minutes":t=6e4;break;default:t=!1}return t},f=function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},d=function(e){return e.map(function(e){return e.toLowerCase()})},h={__checkIsValid:t,__contains:r,__str_includes:n,__dayOfTheWeekStringToNumber:o,__timeObject:i,__range:a,__dateCompare:u,__dateString:s,__typeToMilliseconds:c,__detectLang:f,__arrayToLower:d};return h},e.prototype.messages=function(e){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+e+" should be object or function",notExist:"Error: "+e+" not exist",shouldBeFunction:"Error: "+e+" is shold be function",onlyBrowser:"Error: "+e+" is just supported web-browser"}},e.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},e.prototype.info=function(){return{version:"1.5.3",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},e.prototype.on=function(e){var t=e,r=this.D,n=this.D.getDay(),o=this.messages(),i=this.helpers(),a=this.formats(),u=function(){return new Promise(function(e,r){return 0===n?e(!0):t===!0&&r(!1)})},s=function(){return new Promise(function(e,r){return 1===n?e(!0):t===!0&&r(!1)})},c=function(){return new Promise(function(e,r){return 2===n?e(!0):t===!0&&r(!1)})},f=function(){return new Promise(function(e,r){return 3===n?e(!0):t===!0&&r(!1)})},d=function(){return new Promise(function(e,r){return 4===n?e(!0):t===!0&&r(!1)})},h=function(){return new Promise(function(e,r){return 5===n?e(!0):t===!0&&r(!1)})},l=function(){return new Promise(function(e,r){return 6===n?e(!0):t===!0&&r(!1)})},m=function(e){return new Promise(function(r,a){try{if(!Array.isArray(e))throw o.isNotArray;var u=i.__dayOfTheWeekStringToNumber(e);return i.__contains(u,n)?r(!0):t===!0&&a(!1)}catch(e){return void console.error(e)}})},y=function(){return new Promise(function(e,r){var o=[1,2,3,4,5];return i.__contains(o,n)?e(!0):t===!0&&r(!1)})},w=function(){return new Promise(function(e,r){var o=[0,6];return i.__contains(o,n)?e(!0):t===!0&&r(!1)})},_=function(e){return new Promise(function(r,n){try{if(!e.match(a.date))throw o.date;return e==i.__dateString()?r(!0):t===!0&&n(!1)}catch(e){return void console.error(e)}})},p=function(e,n){return new Promise(function(a,u){var s=new Date(e),c=new Date(n);try{if(s>c)throw o.dateGrater;if(s==c)throw o.dateSameDay;return i.__dateCompare(s,c,r)?a(!0):t===!0&&u(!1)}catch(e){return void console.error(e)}})},g=function(e){return new Promise(function(n,a){try{if(!Array.isArray(e))throw o.isNotArray;return i.__contains(e,r.toISOString().slice(0,10))?n(!0):t===!0&&a(!1)}catch(e){return void console.error(e)}})},v={Sunday:u,Monday:s,Tuesday:c,Wednesday:f,Thursday:d,Friday:h,Saturday:l,Selects:m,Weekdays:y,Weekend:w,Annual:_,DatesBetween:p,DatesContain:g};return v},e.prototype.at=function(e){var t=e,r=this.D,n=(this.D.getDay(),this.D.getHours()),o=this.messages(),i=this.helpers(),a=this.formats(),u=function(e,n){return new Promise(function(u,s){try{if(!e.match(a.time))throw o.time+"at start";if(!n.match(a.time))throw o.time+" at end";var c=r<i.__timeObject(n)&&r>i.__timeObject(e);return c?u(!0):t===!0&&s(!1)}catch(e){return void console.error(e)}})},s=function(e,n){return new Promise(function(u,s){try{if(!e.match(a.time))throw o.time+"at start";if(!n.match(a.time))throw o.time+" at end";var c=r<i.__timeObject(n)&&r>i.__timeObject(e);return c?t===!0&&s(!1):u(!0)}catch(e){return void console.error(e)}})},c=function(e){return new Promise(function(r,i){var a=parseInt(e);try{if(a>23)throw o.startHour;return a===n?r(!0):t===!0&&i(!1)}catch(e){return void console.error(e)}})},f=function(e,r){return new Promise(function(a,u){var s=parseInt(e),c=parseInt(r);try{if(s>23)throw o.startHour;if(c>23)throw o.endHour;var f=i.__range(c,c-s);return f.push(e),i.__contains(f,n)?a(!0):t===!0&&u(!1)}catch(e){return void console.error(e)}})},d=function(e,r){return new Promise(function(r,a){try{if(!Array.isArray(e))throw o.isNotArray;if(1!=!e.some(isNaN))throw o.hourFormat;var u=e.map(function(e){return parseInt(e)});return u.map(function(e){if(e>23)throw o.isNotValidHour}),i.__contains(u,n)?r(!0):t===!0&&a(!1)}catch(e){return void console.error(e)}})},h={Between:u,Unless:s,Hour:c,HoursBetween:f,HourSelects:d};return h},e.prototype.in=function(e){var t=e,r=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),a=this.D.getMonth()+1,u=this.D.getFullYear(),s=function(e){return new Promise(function(r,n){try{if(parseInt(e)>31)throw __msg.day;return e==i?r(!0):t===!0&&n(!1)}catch(e){return void console.error(e)}})},c=function(e){return new Promise(function(o,a){try{if(!Array.isArray(e))throw r.isNotArray;var u=e.map(function(e){return parseInt(e)});return n.__contains(u,i)?o(!0):t===!0&&a(!1)}catch(e){return void console.error(e)}})},f=function(e,o){return new Promise(function(a,u){try{var s=parseInt(e),c=parseInt(o);if(s>30)throw r.startDay;if(c>31)throw r.endDay;var f=n.__range(c,c-s);return f.push(e),n.__contains(f,i)?a(!0):t===!0&&u(!1)}catch(e){return void console.error(e)}})},d=function(e){return new Promise(function(n,o){try{if(parseInt(e)>12)throw r.month;var i=e<10?"0"+e:e;return i==a?n(!0):t===!0&&o(!1)}catch(e){return void console.error(e)}})},h=function(e){return new Promise(function(o,i){try{if(!Array.isArray(e))throw r.isNotArray;return n.__contains(e,a)?o(!0):t===!0&&i(!1)}catch(e){return void console.error(e)}})},l=function(e){return new Promise(function(n,i){try{if(!e.toString().match(o.year))throw r.year;return e==u?n(!0):t===!0&&i(!1)}catch(e){return void console.error(e)}})},m={Day:s,Days:c,DaysBetween:f,Month:d,MonthSelects:h,Year:l};return m},e.prototype.is=function(e){var t=e,r=this.helpers(),n=this.messages(),o=function(e){return new Promise(function(r,n){return e?r(!0):t===!0&&n(!1)})},i=function(e){return new Promise(function(r,n){return e?t===!0&&n(!1):r(!0)})},a=function(e){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;return e.toLowerCase()==r.__detectLang()?n(!0):t===!0&&o(!1)}catch(e){return void console.error(e)}})},u=function(e){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;var i=r.__detectLang();return e.toLowerCase()==i.slice(0,2)?n(!0):t===!0&&o(!1)}catch(e){return void console.error(e)}})},s=function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;return r.__contains(r.__arrayToLower(e),r.__detectLang())?o(!0):t===!0&&i(!1)}catch(e){return void console.error(e)}})},c=function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;var a=r.__detectLang();return r.__contains(r.__arrayToLower(e),a.slice(0,2))?o(!0):t===!0&&i(!1)}catch(e){return void console.error(e)}})},f=function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;return r.__contains(r.__arrayToLower(e),r.__detectLang())?t===!0&&i(!1):o(!0)}catch(e){return void console.error(e)}})},d=function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;var a=r.__detectLang();return r.__contains(r.__arrayToLower(e),a.slice(0,2))?t===!0&&i(!1):o(!0)}catch(e){return void console.error(e)}})},h=function(){return new Promise(function(e,n){try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var o=navigator.userAgent,i=["Windows Phone","iPad","iPhone","iPod","Android"],a=[],u=0;u<i.length;u++)a.push(r.__str_includes(o,i[u]));return a.indexOf(!0)!=-1?e(!0):t===!0&&n(!1)}catch(e){return void console.error(e)}})},l={True:o,False:i,Language:a,Lang:u,LanguageSelects:s,LangSelects:c,LanguageExcepts:f,LangExcepts:d,Mobile:h};return l},e.prototype.timer=function(){var e=this.messages(),t=this.helpers(),r=function(r,n,o){return new Promise(function(i){var a=t.__typeToMilliseconds(r),u=typeof o;try{if(!a)throw e.timeFormat;if(isNaN(n))throw e.numFormat;if(0===n||"0"===n)throw e.numFormat;if(!t.__contains(["object","function","undefined"],u))throw this.messages("type").taskFormat;if("object"===u){if(!("before"in o))throw this.messages("key:before").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;return o.before(),setTimeout(function(){return i(!0)},n*a)}return setTimeout(function(){return i(!0)},n*a)}catch(e){return void console.error(e)}})},n={After:r};return n},e});
!function(e){function r(){}function t(e,r){return function(){e.apply(r,arguments)}}function n(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function o(e,r){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(r):(e._handled=!0,void n._immediateFn(function(){var t=1===e._state?r.onFulfilled:r.onRejected;if(null===t)return void(1===e._state?i:u)(r.promise,e._value);var n;try{n=t(e._value)}catch(e){return void u(r.promise,e)}i(r.promise,n)}))}function i(e,r){try{if(r===e)throw new TypeError("A promise cannot be resolved with itself.");if(r&&("object"==typeof r||"function"==typeof r)){var o=r.then;if(r instanceof n)return e._state=3,e._value=r,void a(e);if("function"==typeof o)return void c(t(o,r),e)}e._state=1,e._value=r,a(e)}catch(r){u(e,r)}}function u(e,r){e._state=2,e._value=r,a(e)}function a(e){2===e._state&&0===e._deferreds.length&&n._immediateFn(function(){e._handled||n._unhandledRejectionFn(e._value)});for(var r=0,t=e._deferreds.length;r<t;r++)o(e,e._deferreds[r]);e._deferreds=null}function s(e,r,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof r?r:null,this.promise=t}function c(e,r){var t=!1;try{e(function(e){t||(t=!0,i(r,e))},function(e){t||(t=!0,u(r,e))})}catch(e){if(t)return;t=!0,u(r,e)}}var f=setTimeout;n.prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,t){var n=new this.constructor(r);return o(this,new s(e,t,n)),n},n.all=function(e){var r=Array.prototype.slice.call(e);return new n(function(e,t){function n(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var a=u.then;if("function"==typeof a)return void a.call(u,function(e){n(i,e)},t)}r[i]=u,0==--o&&e(r)}catch(e){t(e)}}if(0===r.length)return e([]);for(var o=r.length,i=0;i<r.length;i++)n(i,r[i])})},n.resolve=function(e){return e&&"object"==typeof e&&e.constructor===n?e:new n(function(r){r(e)})},n.reject=function(e){return new n(function(r,t){t(e)})},n.race=function(e){return new n(function(r,t){for(var n=0,o=e.length;n<o;n++)e[n].then(r,t)})},n._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){f(e,0)},n._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},n._setImmediateFn=function(e){n._immediateFn=e},n._setUnhandledRejectionFn=function(e){n._unhandledRejectionFn=e},"undefined"!=typeof module&&module.exports?module.exports=n:e.Promise||(e.Promise=n)}(this),function(e,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?module.exports=r():e.SelfTimer=r()}(this,function(){"use strict";function e(e){if(void 0===e)this.D=new Date;else{if(e instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=e}}return e.prototype.helpers=function(){var e=this.D;this.D.getDay();return{__checkIsValid:function(e){return"function"==typeof e||void 0==e},__contains:function(e,r){for(var t=e.length;t--;)if(e[t]===r)return!0;return!1},__str_includes:function(e,r){var t=!1;return e.indexOf(r)>=0&&(t=!0),t},__dayOfTheWeekStringToNumber:function(e){return e.map(function(e){return e.replace(/Sun/g,0)}).map(function(e){return e.replace(/Mon/g,1)}).map(function(e){return e.replace(/Tue/g,2)}).map(function(e){return e.replace(/Wed/g,3)}).map(function(e){return e.replace(/Thu/g,4)}).map(function(e){return e.replace(/Fri/g,5)}).map(function(e){return e.replace(/Sat/g,6)}).map(function(e){return parseInt(e)})},__timeObject:function(e){var r=e.split(/:|\s/),t=new Date;return"pm"==r.pop().toLowerCase()&&(r[0]=+r[0]+12),t.setHours(+r.shift()),t.setMinutes(+r.shift()),t},__range:function(e,r){1==arguments.length&&(r=e,e=0);for(var t=[],n=0;n<r;n++)t.push(e-n);return t},__dateCompare:function(e,r,t){return t<r.setDate(r.getDate()+1)&&t>e},__dateString:function(){var r=e.getMonth()+1,t=e.getDate();return r.length<2&&(r="0"+r),t.length<2&&(t="0"+t),[r,t].join("-")},__typeToMilliseconds:function(e){var r;switch(e){case"s":case"sec":case"second":case"seconds":r=1e3;break;case"m":case"min":case"minute":case"minutes":r=6e4;break;default:r=!1}return r},__detectLang:function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},__arrayToLower:function(e){return e.map(function(e){return e.toLowerCase()})}}},e.prototype.messages=function(e){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startMin:"Error: start minute should be less than 59",endMin:"Error: end minute should be until 59",minFormat:"Error: minutes should be numberic",isNotValidMin:"Error: minute should be until 59",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+e+" should be object or function",notExist:"Error: "+e+" not exist",shouldBeFunction:"Error: "+e+" is shold be function",onlyBrowser:"Error: "+e+" is just supported web-browser"}},e.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},e.prototype.info=function(){return{version:"1.6.0",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Min","MinBetween","MinSelects","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},e.prototype.on=function(e){var r=e,t=this.D,n=this.D.getDay(),o=this.messages(),i=this.helpers(),u=this.formats();return{Sunday:function(){return new Promise(function(e,t){return 0===n?e(!0):!0===r&&t(!1)})},Monday:function(){return new Promise(function(e,t){return 1===n?e(!0):!0===r&&t(!1)})},Tuesday:function(){return new Promise(function(e,t){return 2===n?e(!0):!0===r&&t(!1)})},Wednesday:function(){return new Promise(function(e,t){return 3===n?e(!0):!0===r&&t(!1)})},Thursday:function(){return new Promise(function(e,t){return 4===n?e(!0):!0===r&&t(!1)})},Friday:function(){return new Promise(function(e,t){return 5===n?e(!0):!0===r&&t(!1)})},Saturday:function(){return new Promise(function(e,t){return 6===n?e(!0):!0===r&&t(!1)})},Selects:function(e){return new Promise(function(t,u){try{if(!Array.isArray(e))throw o.isNotArray;var a=i.__dayOfTheWeekStringToNumber(e);return i.__contains(a,n)?t(!0):!0===r&&u(!1)}catch(e){return void console.error(e)}})},Weekdays:function(){return new Promise(function(e,t){var o=[1,2,3,4,5];return i.__contains(o,n)?e(!0):!0===r&&t(!1)})},Weekend:function(){return new Promise(function(e,t){var o=[0,6];return i.__contains(o,n)?e(!0):!0===r&&t(!1)})},Annual:function(e){return new Promise(function(t,n){try{if(!e.match(u.date))throw o.date;return e==i.__dateString()?t(!0):!0===r&&n(!1)}catch(e){return void console.error(e)}})},DatesBetween:function(e,n){return new Promise(function(u,a){var s=new Date(e),c=new Date(n);try{if(s>c)throw o.dateGrater;if(s==c)throw o.dateSameDay;return i.__dateCompare(s,c,t)?u(!0):!0===r&&a(!1)}catch(e){return void console.error(e)}})},DatesContain:function(e){return new Promise(function(n,u){try{if(!Array.isArray(e))throw o.isNotArray;return i.__contains(e,t.toISOString().slice(0,10))?n(!0):!0===r&&u(!1)}catch(e){return void console.error(e)}})}}},e.prototype.at=function(e){var r=e,t=this.D,n=(this.D.getDay(),this.D.getMinutes()),o=this.D.getHours(),i=this.messages(),u=this.helpers(),a=this.formats();return{Between:function(e,n){return new Promise(function(o,s){try{if(!e.match(a.time))throw i.time+"at start";if(!n.match(a.time))throw i.time+" at end";return t<u.__timeObject(n)&&t>u.__timeObject(e)?o(!0):!0===r&&s(!1)}catch(e){return void console.error(e)}})},Unless:function(e,n){return new Promise(function(o,s){try{if(!e.match(a.time))throw i.time+"at start";if(!n.match(a.time))throw i.time+" at end";return t<u.__timeObject(n)&&t>u.__timeObject(e)?!0===r&&s(!1):o(!0)}catch(e){return void console.error(e)}})},Min:function(e){return new Promise(function(t,o){var u=parseInt(e);try{if(u>59)throw i.startMin;return u===n?t(!0):!0===r&&o(!1)}catch(e){return void console.error(e)}})},MinBetween:function(e,t){return new Promise(function(o,a){var s=parseInt(e),c=parseInt(t);try{if(s>59)throw i.startMin;if(c>59)throw i.endMin;var f=u.__range(c,c-s);return f.push(e),u.__contains(f,n)?o(!0):!0===r&&a(!1)}catch(e){return void console.error(e)}})},MinSelects:function(e,t){return new Promise(function(t,o){try{if(!Array.isArray(e))throw i.isNotArray;if(1!=!e.some(isNaN))throw i.minFormat;var a=e.map(function(e){return parseInt(e)});return a.map(function(e){if(e>59)throw i.isNotValidHour}),u.__contains(a,n)?t(!0):!0===r&&o(!1)}catch(e){return void console.error(e)}})},Hour:function(e){return new Promise(function(t,n){var u=parseInt(e);try{if(u>23)throw i.startHour;return u===o?t(!0):!0===r&&n(!1)}catch(e){return void console.error(e)}})},HoursBetween:function(e,t){return new Promise(function(n,a){var s=parseInt(e),c=parseInt(t);try{if(s>23)throw i.startHour;if(c>23)throw i.endHour;var f=u.__range(c,c-s);return f.push(e),u.__contains(f,o)?n(!0):!0===r&&a(!1)}catch(e){return void console.error(e)}})},HourSelects:function(e,t){return new Promise(function(t,n){try{if(!Array.isArray(e))throw i.isNotArray;if(1!=!e.some(isNaN))throw i.hourFormat;var a=e.map(function(e){return parseInt(e)});return a.map(function(e){if(e>23)throw i.isNotValidHour}),u.__contains(a,o)?t(!0):!0===r&&n(!1)}catch(e){return void console.error(e)}})}}},e.prototype.in=function(e){var r=e,t=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),u=this.D.getMonth()+1,a=this.D.getFullYear();return{Day:function(e){return new Promise(function(t,n){try{if(parseInt(e)>31)throw __msg.day;return e==i?t(!0):!0===r&&n(!1)}catch(e){return void console.error(e)}})},Days:function(e){return new Promise(function(o,u){try{if(!Array.isArray(e))throw t.isNotArray;var a=e.map(function(e){return parseInt(e)});return n.__contains(a,i)?o(!0):!0===r&&u(!1)}catch(e){return void console.error(e)}})},DaysBetween:function(e,o){return new Promise(function(u,a){try{var s=parseInt(e),c=parseInt(o);if(s>30)throw t.startDay;if(c>31)throw t.endDay;var f=n.__range(c,c-s);return f.push(e),n.__contains(f,i)?u(!0):!0===r&&a(!1)}catch(e){return void console.error(e)}})},Month:function(e){return new Promise(function(n,o){try{if(parseInt(e)>12)throw t.month;return(e<10?"0"+e:e)==u?n(!0):!0===r&&o(!1)}catch(e){return void console.error(e)}})},MonthSelects:function(e){return new Promise(function(o,i){try{if(!Array.isArray(e))throw t.isNotArray;return n.__contains(e,u)?o(!0):!0===r&&i(!1)}catch(e){return void console.error(e)}})},Year:function(e){return new Promise(function(n,i){try{if(!e.toString().match(o.year))throw t.year;return e==a?n(!0):!0===r&&i(!1)}catch(e){return void console.error(e)}})}}},e.prototype.is=function(e){var r=e,t=this.helpers(),n=this.messages();return{True:function(e){return new Promise(function(t,n){return e?t(!0):!0===r&&n(!1)})},False:function(e){return new Promise(function(t,n){return e?!0===r&&n(!1):t(!0)})},Language:function(e){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;return e.toLowerCase()==t.__detectLang()?n(!0):!0===r&&o(!1)}catch(e){return void console.error(e)}})},Lang:function(e){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;var i=t.__detectLang();return e.toLowerCase()==i.slice(0,2)?n(!0):!0===r&&o(!1)}catch(e){return void console.error(e)}})},LanguageSelects:function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;return t.__contains(t.__arrayToLower(e),t.__detectLang())?o(!0):!0===r&&i(!1)}catch(e){return void console.error(e)}})},LangSelects:function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;var u=t.__detectLang();return t.__contains(t.__arrayToLower(e),u.slice(0,2))?o(!0):!0===r&&i(!1)}catch(e){return void console.error(e)}})},LanguageExcepts:function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;return t.__contains(t.__arrayToLower(e),t.__detectLang())?!0===r&&i(!1):o(!0)}catch(e){return void console.error(e)}})},LangExcepts:function(e){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(e))throw n.isNotArray;var u=t.__detectLang();return t.__contains(t.__arrayToLower(e),u.slice(0,2))?!0===r&&i(!1):o(!0)}catch(e){return void console.error(e)}})},Mobile:function(){return new Promise(function(e,n){try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var o=navigator.userAgent,i=["Windows Phone","iPad","iPhone","iPod","Android"],u=[],a=0;a<i.length;a++)u.push(t.__str_includes(o,i[a]));return-1!=u.indexOf(!0)?e(!0):!0===r&&n(!1)}catch(e){return void console.error(e)}})}}},e.prototype.timer=function(){var e=this.messages(),r=this.helpers();return{After:function(t,n,o){return new Promise(function(i){var u=r.__typeToMilliseconds(t),a=typeof o;try{if(!u)throw e.timeFormat;if(isNaN(n))throw e.numFormat;if(0===n||"0"===n)throw e.numFormat;if(!r.__contains(["object","function","undefined"],a))throw this.messages("type").taskFormat;if("object"===a){if(!("before"in o))throw this.messages("key:before").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;return o.before(),setTimeout(function(){return i(!0)},n*u)}return setTimeout(function(){return i(!0)},n*u)}catch(e){return void console.error(e)}})}}},e});

@@ -252,2 +252,6 @@ ;(function(root, factory) {

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -287,3 +291,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -305,3 +309,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -571,2 +584,3 @@ is: [

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -639,3 +653,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -726,2 +815,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -728,0 +820,0 @@ HoursBetween: HoursBetween,

@@ -1,1 +0,1 @@

!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.SelfTimer=e()}(this,function(){"use strict";function r(r){if("undefined"==typeof r)this.D=new Date;else{if(r instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=r}}return r.prototype.helpers=function(){var r=this.D,e=(this.D.getDay(),function(r){return"function"==typeof r||void 0==r}),t=function(r,e){for(var t=r.length;t--;)if(r[t]===e)return!0;return!1},n=function(r,e){var t=!1;return r.indexOf(e)>=0&&(t=!0),t},o=function(r){return r.map(function(r){return r.replace(/Sun/g,0)}).map(function(r){return r.replace(/Mon/g,1)}).map(function(r){return r.replace(/Tue/g,2)}).map(function(r){return r.replace(/Wed/g,3)}).map(function(r){return r.replace(/Thu/g,4)}).map(function(r){return r.replace(/Fri/g,5)}).map(function(r){return r.replace(/Sat/g,6)}).map(function(r){return parseInt(r)})},i=function(r){var e=r.split(/:|\s/),t=new Date;return"pm"==e.pop().toLowerCase()&&(e[0]=+e[0]+12),t.setHours(+e.shift()),t.setMinutes(+e.shift()),t},a=function(r,e){1==arguments.length&&(e=r,r=0);for(var t=[],n=0;n<e;n++)t.push(r-n);return t},s=function(r,e,t){return t<e.setDate(e.getDate()+1)&&t>r},u=function(){var e=r.getMonth()+1,t=r.getDate();return e.length<2&&(e="0"+e),t.length<2&&(t="0"+t),[e,t].join("-")},c=function(r){var e;switch(r){case"s":case"sec":case"second":case"seconds":e=1e3;break;case"m":case"min":case"minute":case"minutes":e=6e4;break;default:e=!1}return e},f=function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},h=function(r){return r.map(function(r){return r.toLowerCase()})},d={__checkIsValid:e,__contains:t,__str_includes:n,__dayOfTheWeekStringToNumber:o,__timeObject:i,__range:a,__dateCompare:s,__dateString:u,__typeToMilliseconds:c,__detectLang:f,__arrayToLower:h};return d},r.prototype.messages=function(r){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+r+" should be object or function",notExist:"Error: "+r+" not exist",shouldBeFunction:"Error: "+r+" is shold be function",onlyBrowser:"Error: "+r+" is just supported web-browser"}},r.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},r.prototype.info=function(){return{version:"1.5.3",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},r.prototype.on=function(r){var e=r,t=this.D,n=this.D.getDay(),o=this.messages(),i=this.helpers(),a=this.formats(),s=function(){return new Promise(function(r,t){return 0===n?r(!0):e===!0&&t(!1)})},u=function(){return new Promise(function(r,t){return 1===n?r(!0):e===!0&&t(!1)})},c=function(){return new Promise(function(r,t){return 2===n?r(!0):e===!0&&t(!1)})},f=function(){return new Promise(function(r,t){return 3===n?r(!0):e===!0&&t(!1)})},h=function(){return new Promise(function(r,t){return 4===n?r(!0):e===!0&&t(!1)})},d=function(){return new Promise(function(r,t){return 5===n?r(!0):e===!0&&t(!1)})},m=function(){return new Promise(function(r,t){return 6===n?r(!0):e===!0&&t(!1)})},y=function(r){return new Promise(function(t,a){try{if(!Array.isArray(r))throw o.isNotArray;var s=i.__dayOfTheWeekStringToNumber(r);return i.__contains(s,n)?t(!0):e===!0&&a(!1)}catch(r){return void console.error(r)}})},w=function(){return new Promise(function(r,t){var o=[1,2,3,4,5];return i.__contains(o,n)?r(!0):e===!0&&t(!1)})},l=function(){return new Promise(function(r,t){var o=[0,6];return i.__contains(o,n)?r(!0):e===!0&&t(!1)})},g=function(r){return new Promise(function(t,n){try{if(!r.match(a.date))throw o.date;return r==i.__dateString()?t(!0):e===!0&&n(!1)}catch(r){return void console.error(r)}})},_=function(r,n){return new Promise(function(a,s){var u=new Date(r),c=new Date(n);try{if(u>c)throw o.dateGrater;if(u==c)throw o.dateSameDay;return i.__dateCompare(u,c,t)?a(!0):e===!0&&s(!1)}catch(r){return void console.error(r)}})},p=function(r){return new Promise(function(n,a){try{if(!Array.isArray(r))throw o.isNotArray;return i.__contains(r,t.toISOString().slice(0,10))?n(!0):e===!0&&a(!1)}catch(r){return void console.error(r)}})},v={Sunday:s,Monday:u,Tuesday:c,Wednesday:f,Thursday:h,Friday:d,Saturday:m,Selects:y,Weekdays:w,Weekend:l,Annual:g,DatesBetween:_,DatesContain:p};return v},r.prototype.at=function(r){var e=r,t=this.D,n=(this.D.getDay(),this.D.getHours()),o=this.messages(),i=this.helpers(),a=this.formats(),s=function(r,n){return new Promise(function(s,u){try{if(!r.match(a.time))throw o.time+"at start";if(!n.match(a.time))throw o.time+" at end";var c=t<i.__timeObject(n)&&t>i.__timeObject(r);return c?s(!0):e===!0&&u(!1)}catch(r){return void console.error(r)}})},u=function(r,n){return new Promise(function(s,u){try{if(!r.match(a.time))throw o.time+"at start";if(!n.match(a.time))throw o.time+" at end";var c=t<i.__timeObject(n)&&t>i.__timeObject(r);return c?e===!0&&u(!1):s(!0)}catch(r){return void console.error(r)}})},c=function(r){return new Promise(function(t,i){var a=parseInt(r);try{if(a>23)throw o.startHour;return a===n?t(!0):e===!0&&i(!1)}catch(r){return void console.error(r)}})},f=function(r,t){return new Promise(function(a,s){var u=parseInt(r),c=parseInt(t);try{if(u>23)throw o.startHour;if(c>23)throw o.endHour;var f=i.__range(c,c-u);return f.push(r),i.__contains(f,n)?a(!0):e===!0&&s(!1)}catch(r){return void console.error(r)}})},h=function(r,t){return new Promise(function(t,a){try{if(!Array.isArray(r))throw o.isNotArray;if(1!=!r.some(isNaN))throw o.hourFormat;var s=r.map(function(r){return parseInt(r)});return s.map(function(r){if(r>23)throw o.isNotValidHour}),i.__contains(s,n)?t(!0):e===!0&&a(!1)}catch(r){return void console.error(r)}})},d={Between:s,Unless:u,Hour:c,HoursBetween:f,HourSelects:h};return d},r.prototype.in=function(r){var e=r,t=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),a=this.D.getMonth()+1,s=this.D.getFullYear(),u=function(r){return new Promise(function(t,n){try{if(parseInt(r)>31)throw __msg.day;return r==i?t(!0):e===!0&&n(!1)}catch(r){return void console.error(r)}})},c=function(r){return new Promise(function(o,a){try{if(!Array.isArray(r))throw t.isNotArray;var s=r.map(function(r){return parseInt(r)});return n.__contains(s,i)?o(!0):e===!0&&a(!1)}catch(r){return void console.error(r)}})},f=function(r,o){return new Promise(function(a,s){try{var u=parseInt(r),c=parseInt(o);if(u>30)throw t.startDay;if(c>31)throw t.endDay;var f=n.__range(c,c-u);return f.push(r),n.__contains(f,i)?a(!0):e===!0&&s(!1)}catch(r){return void console.error(r)}})},h=function(r){return new Promise(function(n,o){try{if(parseInt(r)>12)throw t.month;var i=r<10?"0"+r:r;return i==a?n(!0):e===!0&&o(!1)}catch(r){return void console.error(r)}})},d=function(r){return new Promise(function(o,i){try{if(!Array.isArray(r))throw t.isNotArray;return n.__contains(r,a)?o(!0):e===!0&&i(!1)}catch(r){return void console.error(r)}})},m=function(r){return new Promise(function(n,i){try{if(!r.toString().match(o.year))throw t.year;return r==s?n(!0):e===!0&&i(!1)}catch(r){return void console.error(r)}})},y={Day:u,Days:c,DaysBetween:f,Month:h,MonthSelects:d,Year:m};return y},r.prototype.is=function(r){var e=r,t=this.helpers(),n=this.messages(),o=function(r){return new Promise(function(t,n){return r?t(!0):e===!0&&n(!1)})},i=function(r){return new Promise(function(t,n){return r?e===!0&&n(!1):t(!0)})},a=function(r){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;return r.toLowerCase()==t.__detectLang()?n(!0):e===!0&&o(!1)}catch(r){return void console.error(r)}})},s=function(r){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;var i=t.__detectLang();return r.toLowerCase()==i.slice(0,2)?n(!0):e===!0&&o(!1)}catch(r){return void console.error(r)}})},u=function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;return t.__contains(t.__arrayToLower(r),t.__detectLang())?o(!0):e===!0&&i(!1)}catch(r){return void console.error(r)}})},c=function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;var a=t.__detectLang();return t.__contains(t.__arrayToLower(r),a.slice(0,2))?o(!0):e===!0&&i(!1)}catch(r){return void console.error(r)}})},f=function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;return t.__contains(t.__arrayToLower(r),t.__detectLang())?e===!0&&i(!1):o(!0)}catch(r){return void console.error(r)}})},h=function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;var a=t.__detectLang();return t.__contains(t.__arrayToLower(r),a.slice(0,2))?e===!0&&i(!1):o(!0)}catch(r){return void console.error(r)}})},d=function(){return new Promise(function(r,n){try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var o=navigator.userAgent,i=["Windows Phone","iPad","iPhone","iPod","Android"],a=[],s=0;s<i.length;s++)a.push(t.__str_includes(o,i[s]));return a.indexOf(!0)!=-1?r(!0):e===!0&&n(!1)}catch(r){return void console.error(r)}})},m={True:o,False:i,Language:a,Lang:s,LanguageSelects:u,LangSelects:c,LanguageExcepts:f,LangExcepts:h,Mobile:d};return m},r.prototype.timer=function(){var r=this.messages(),e=this.helpers(),t=function(t,n,o){return new Promise(function(i){var a=e.__typeToMilliseconds(t),s=typeof o;try{if(!a)throw r.timeFormat;if(isNaN(n))throw r.numFormat;if(0===n||"0"===n)throw r.numFormat;if(!e.__contains(["object","function","undefined"],s))throw this.messages("type").taskFormat;if("object"===s){if(!("before"in o))throw this.messages("key:before").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;return o.before(),setTimeout(function(){return i(!0)},n*a)}return setTimeout(function(){return i(!0)},n*a)}catch(r){return void console.error(r)}})},n={After:t};return n},r});
!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.SelfTimer=e()}(this,function(){"use strict";function r(r){if(void 0===r)this.D=new Date;else{if(r instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=r}}return r.prototype.helpers=function(){var r=this.D;this.D.getDay();return{__checkIsValid:function(r){return"function"==typeof r||void 0==r},__contains:function(r,e){for(var t=r.length;t--;)if(r[t]===e)return!0;return!1},__str_includes:function(r,e){var t=!1;return r.indexOf(e)>=0&&(t=!0),t},__dayOfTheWeekStringToNumber:function(r){return r.map(function(r){return r.replace(/Sun/g,0)}).map(function(r){return r.replace(/Mon/g,1)}).map(function(r){return r.replace(/Tue/g,2)}).map(function(r){return r.replace(/Wed/g,3)}).map(function(r){return r.replace(/Thu/g,4)}).map(function(r){return r.replace(/Fri/g,5)}).map(function(r){return r.replace(/Sat/g,6)}).map(function(r){return parseInt(r)})},__timeObject:function(r){var e=r.split(/:|\s/),t=new Date;return"pm"==e.pop().toLowerCase()&&(e[0]=+e[0]+12),t.setHours(+e.shift()),t.setMinutes(+e.shift()),t},__range:function(r,e){1==arguments.length&&(e=r,r=0);for(var t=[],n=0;n<e;n++)t.push(r-n);return t},__dateCompare:function(r,e,t){return t<e.setDate(e.getDate()+1)&&t>r},__dateString:function(){var e=r.getMonth()+1,t=r.getDate();return e.length<2&&(e="0"+e),t.length<2&&(t="0"+t),[e,t].join("-")},__typeToMilliseconds:function(r){var e;switch(r){case"s":case"sec":case"second":case"seconds":e=1e3;break;case"m":case"min":case"minute":case"minutes":e=6e4;break;default:e=!1}return e},__detectLang:function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},__arrayToLower:function(r){return r.map(function(r){return r.toLowerCase()})}}},r.prototype.messages=function(r){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startMin:"Error: start minute should be less than 59",endMin:"Error: end minute should be until 59",minFormat:"Error: minutes should be numberic",isNotValidMin:"Error: minute should be until 59",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+r+" should be object or function",notExist:"Error: "+r+" not exist",shouldBeFunction:"Error: "+r+" is shold be function",onlyBrowser:"Error: "+r+" is just supported web-browser"}},r.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},r.prototype.info=function(){return{version:"1.6.0",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Min","MinBetween","MinSelects","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},r.prototype.on=function(r){var e=r,t=this.D,n=this.D.getDay(),o=this.messages(),i=this.helpers(),a=this.formats();return{Sunday:function(){return new Promise(function(r,t){return 0===n?r(!0):!0===e&&t(!1)})},Monday:function(){return new Promise(function(r,t){return 1===n?r(!0):!0===e&&t(!1)})},Tuesday:function(){return new Promise(function(r,t){return 2===n?r(!0):!0===e&&t(!1)})},Wednesday:function(){return new Promise(function(r,t){return 3===n?r(!0):!0===e&&t(!1)})},Thursday:function(){return new Promise(function(r,t){return 4===n?r(!0):!0===e&&t(!1)})},Friday:function(){return new Promise(function(r,t){return 5===n?r(!0):!0===e&&t(!1)})},Saturday:function(){return new Promise(function(r,t){return 6===n?r(!0):!0===e&&t(!1)})},Selects:function(r){return new Promise(function(t,a){try{if(!Array.isArray(r))throw o.isNotArray;var s=i.__dayOfTheWeekStringToNumber(r);return i.__contains(s,n)?t(!0):!0===e&&a(!1)}catch(r){return void console.error(r)}})},Weekdays:function(){return new Promise(function(r,t){var o=[1,2,3,4,5];return i.__contains(o,n)?r(!0):!0===e&&t(!1)})},Weekend:function(){return new Promise(function(r,t){var o=[0,6];return i.__contains(o,n)?r(!0):!0===e&&t(!1)})},Annual:function(r){return new Promise(function(t,n){try{if(!r.match(a.date))throw o.date;return r==i.__dateString()?t(!0):!0===e&&n(!1)}catch(r){return void console.error(r)}})},DatesBetween:function(r,n){return new Promise(function(a,s){var u=new Date(r),c=new Date(n);try{if(u>c)throw o.dateGrater;if(u==c)throw o.dateSameDay;return i.__dateCompare(u,c,t)?a(!0):!0===e&&s(!1)}catch(r){return void console.error(r)}})},DatesContain:function(r){return new Promise(function(n,a){try{if(!Array.isArray(r))throw o.isNotArray;return i.__contains(r,t.toISOString().slice(0,10))?n(!0):!0===e&&a(!1)}catch(r){return void console.error(r)}})}}},r.prototype.at=function(r){var e=r,t=this.D,n=(this.D.getDay(),this.D.getMinutes()),o=this.D.getHours(),i=this.messages(),a=this.helpers(),s=this.formats();return{Between:function(r,n){return new Promise(function(o,u){try{if(!r.match(s.time))throw i.time+"at start";if(!n.match(s.time))throw i.time+" at end";return t<a.__timeObject(n)&&t>a.__timeObject(r)?o(!0):!0===e&&u(!1)}catch(r){return void console.error(r)}})},Unless:function(r,n){return new Promise(function(o,u){try{if(!r.match(s.time))throw i.time+"at start";if(!n.match(s.time))throw i.time+" at end";return t<a.__timeObject(n)&&t>a.__timeObject(r)?!0===e&&u(!1):o(!0)}catch(r){return void console.error(r)}})},Min:function(r){return new Promise(function(t,o){var a=parseInt(r);try{if(a>59)throw i.startMin;return a===n?t(!0):!0===e&&o(!1)}catch(r){return void console.error(r)}})},MinBetween:function(r,t){return new Promise(function(o,s){var u=parseInt(r),c=parseInt(t);try{if(u>59)throw i.startMin;if(c>59)throw i.endMin;var f=a.__range(c,c-u);return f.push(r),a.__contains(f,n)?o(!0):!0===e&&s(!1)}catch(r){return void console.error(r)}})},MinSelects:function(r,t){return new Promise(function(t,o){try{if(!Array.isArray(r))throw i.isNotArray;if(1!=!r.some(isNaN))throw i.minFormat;var s=r.map(function(r){return parseInt(r)});return s.map(function(r){if(r>59)throw i.isNotValidHour}),a.__contains(s,n)?t(!0):!0===e&&o(!1)}catch(r){return void console.error(r)}})},Hour:function(r){return new Promise(function(t,n){var a=parseInt(r);try{if(a>23)throw i.startHour;return a===o?t(!0):!0===e&&n(!1)}catch(r){return void console.error(r)}})},HoursBetween:function(r,t){return new Promise(function(n,s){var u=parseInt(r),c=parseInt(t);try{if(u>23)throw i.startHour;if(c>23)throw i.endHour;var f=a.__range(c,c-u);return f.push(r),a.__contains(f,o)?n(!0):!0===e&&s(!1)}catch(r){return void console.error(r)}})},HourSelects:function(r,t){return new Promise(function(t,n){try{if(!Array.isArray(r))throw i.isNotArray;if(1!=!r.some(isNaN))throw i.hourFormat;var s=r.map(function(r){return parseInt(r)});return s.map(function(r){if(r>23)throw i.isNotValidHour}),a.__contains(s,o)?t(!0):!0===e&&n(!1)}catch(r){return void console.error(r)}})}}},r.prototype.in=function(r){var e=r,t=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),a=this.D.getMonth()+1,s=this.D.getFullYear();return{Day:function(r){return new Promise(function(t,n){try{if(parseInt(r)>31)throw __msg.day;return r==i?t(!0):!0===e&&n(!1)}catch(r){return void console.error(r)}})},Days:function(r){return new Promise(function(o,a){try{if(!Array.isArray(r))throw t.isNotArray;var s=r.map(function(r){return parseInt(r)});return n.__contains(s,i)?o(!0):!0===e&&a(!1)}catch(r){return void console.error(r)}})},DaysBetween:function(r,o){return new Promise(function(a,s){try{var u=parseInt(r),c=parseInt(o);if(u>30)throw t.startDay;if(c>31)throw t.endDay;var f=n.__range(c,c-u);return f.push(r),n.__contains(f,i)?a(!0):!0===e&&s(!1)}catch(r){return void console.error(r)}})},Month:function(r){return new Promise(function(n,o){try{if(parseInt(r)>12)throw t.month;return(r<10?"0"+r:r)==a?n(!0):!0===e&&o(!1)}catch(r){return void console.error(r)}})},MonthSelects:function(r){return new Promise(function(o,i){try{if(!Array.isArray(r))throw t.isNotArray;return n.__contains(r,a)?o(!0):!0===e&&i(!1)}catch(r){return void console.error(r)}})},Year:function(r){return new Promise(function(n,i){try{if(!r.toString().match(o.year))throw t.year;return r==s?n(!0):!0===e&&i(!1)}catch(r){return void console.error(r)}})}}},r.prototype.is=function(r){var e=r,t=this.helpers(),n=this.messages();return{True:function(r){return new Promise(function(t,n){return r?t(!0):!0===e&&n(!1)})},False:function(r){return new Promise(function(t,n){return r?!0===e&&n(!1):t(!0)})},Language:function(r){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;return r.toLowerCase()==t.__detectLang()?n(!0):!0===e&&o(!1)}catch(r){return void console.error(r)}})},Lang:function(r){return new Promise(function(n,o){try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;var i=t.__detectLang();return r.toLowerCase()==i.slice(0,2)?n(!0):!0===e&&o(!1)}catch(r){return void console.error(r)}})},LanguageSelects:function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;return t.__contains(t.__arrayToLower(r),t.__detectLang())?o(!0):!0===e&&i(!1)}catch(r){return void console.error(r)}})},LangSelects:function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;var a=t.__detectLang();return t.__contains(t.__arrayToLower(r),a.slice(0,2))?o(!0):!0===e&&i(!1)}catch(r){return void console.error(r)}})},LanguageExcepts:function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;return t.__contains(t.__arrayToLower(r),t.__detectLang())?!0===e&&i(!1):o(!0)}catch(r){return void console.error(r)}})},LangExcepts:function(r){return new Promise(function(o,i){try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(r))throw n.isNotArray;var a=t.__detectLang();return t.__contains(t.__arrayToLower(r),a.slice(0,2))?!0===e&&i(!1):o(!0)}catch(r){return void console.error(r)}})},Mobile:function(){return new Promise(function(r,n){try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var o=navigator.userAgent,i=["Windows Phone","iPad","iPhone","iPod","Android"],a=[],s=0;s<i.length;s++)a.push(t.__str_includes(o,i[s]));return-1!=a.indexOf(!0)?r(!0):!0===e&&n(!1)}catch(r){return void console.error(r)}})}}},r.prototype.timer=function(){var r=this.messages(),e=this.helpers();return{After:function(t,n,o){return new Promise(function(i){var a=e.__typeToMilliseconds(t),s=typeof o;try{if(!a)throw r.timeFormat;if(isNaN(n))throw r.numFormat;if(0===n||"0"===n)throw r.numFormat;if(!e.__contains(["object","function","undefined"],s))throw this.messages("type").taskFormat;if("object"===s){if(!("before"in o))throw this.messages("key:before").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;return o.before(),setTimeout(function(){return i(!0)},n*a)}return setTimeout(function(){return i(!0)},n*a)}catch(r){return void console.error(r)}})}}},r});

@@ -252,2 +252,6 @@ ;(function(root, factory) {

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -287,3 +291,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -305,3 +309,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -558,2 +571,3 @@ is: [

var _hour = this.D.getHours();
var _minute = this.D.getMinutes();
var _msg = this.messages();

@@ -623,2 +637,70 @@ var _h = this.helpers();

var Min = function(minute, task) {
if (_h.__checkIsValid(task)) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
if (time === _minute) return task !== undefined ? task() : true;
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
} // ! Minute()
var MinBetween = function(from, to, task) {
if (_h.__checkIsValid(task)) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
if (_h.__contains(arr, _minute)) {
return task !== undefined ? task() : true;
} // ! if()
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinutesBetween()
var MinSelects = function(minutes, task) {
if (_h.__checkIsValid(task)) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidMin;
});
if (_h.__contains(array, _minute)) {
return task !== undefined ? task() : true;
} // ! if
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinuteSelects()
/**

@@ -712,2 +794,5 @@ * [ at().Hour description]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -1268,3 +1353,45 @@ HoursBetween: HoursBetween,

/**
* [ With description]
* @param {[ Boolean ]} val
*/
SelfTimer.prototype.check = function() {
// Private Variable
var _Flag = true;
/**
* @param {[ Any ]} val [ true || empty]
* @return this
*/
var With = function(val) {
if (val !== true) _Flag = false;
return this;
}; // ! With
/**
* @param {[ Function ]} task
* @return {[ Function ]} || {[ Bool ]}
*/
var Done = function(task) {
var callback = typeof task;
if (callback === "undefined") {
return _Flag === true ? true : false;
} else if (callback === "function") {
return _Flag === true ? task() : false;
} else {
throw new Error("Done() of argument should be 'function' or 'empty' .");
}
}; // ! Done
var REGISTER = {
With: With,
Done: Done
}; // REGISTER
return REGISTER;
};
return SelfTimer;
}));

@@ -1,1 +0,1 @@

!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.SelfTimer=e()}(this,function(){"use strict";function t(t){if("undefined"==typeof t)this.D=new Date;else{if(t instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=t}}return t.prototype.helpers=function(){var t=this.D,e=(this.D.getDay(),function(t){return"function"==typeof t||void 0==t}),r=function(t,e){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1},n=function(t,e){var r=!1;return t.indexOf(e)>=0&&(r=!0),r},o=function(t){return t.map(function(t){return t.replace(/Sun/g,0)}).map(function(t){return t.replace(/Mon/g,1)}).map(function(t){return t.replace(/Tue/g,2)}).map(function(t){return t.replace(/Wed/g,3)}).map(function(t){return t.replace(/Thu/g,4)}).map(function(t){return t.replace(/Fri/g,5)}).map(function(t){return t.replace(/Sat/g,6)}).map(function(t){return parseInt(t)})},i=function(t){var e=t.split(/:|\s/),r=new Date;return"pm"==e.pop().toLowerCase()&&(e[0]=+e[0]+12),r.setHours(+e.shift()),r.setMinutes(+e.shift()),r},a=function(t,e){1==arguments.length&&(e=t,t=0);for(var r=[],n=0;n<e;n++)r.push(t-n);return r},s=function(t,e,r){return r<e.setDate(e.getDate()+1)&&r>t},c=function(){var e=t.getMonth()+1,r=t.getDate();return e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),[e,r].join("-")},u=function(t){var e;switch(t){case"s":case"sec":case"second":case"seconds":e=1e3;break;case"m":case"min":case"minute":case"minutes":e=6e4;break;default:e=!1}return e},f=function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},h=function(t){return t.map(function(t){return t.toLowerCase()})},d={__checkIsValid:e,__contains:r,__str_includes:n,__dayOfTheWeekStringToNumber:o,__timeObject:i,__range:a,__dateCompare:s,__dateString:c,__typeToMilliseconds:u,__detectLang:f,__arrayToLower:h};return d},t.prototype.messages=function(t){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+t+" should be object or function",notExist:"Error: "+t+" not exist",shouldBeFunction:"Error: "+t+" is shold be function",onlyBrowser:"Error: "+t+" is just supported web-browser"}},t.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},t.prototype.info=function(){return{version:"1.5.3",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},t.prototype.on=function(){var t=this.D,e=this.D.getDay(),r=this.messages(),n=this.helpers(),o=this.formats(),i=function(t){if(n.__checkIsValid(t)&&0===e)return void 0===t||t()},a=function(t){if(n.__checkIsValid(t)&&1===e)return void 0===t||t()},s=function(t){if(n.__checkIsValid(t)&&2===e)return void 0==t||t()},c=function(t){if(n.__checkIsValid(t)&&3===e)return void 0===t||t()},u=function(t){if(n.__checkIsValid(t)&&4===e)return void 0===t||t()},f=function(t){if(n.__checkIsValid(t)&&5===e)return void 0===t||t()},h=function(t){if(n.__checkIsValid(t)&&6===e)return void 0===t||t()},d=function(t,o){if(n.__checkIsValid(o))try{if(!Array.isArray(t))throw r.isNotArray;var i=n.__dayOfTheWeekStringToNumber(t);if(n.__contains(i,e))return void 0===o||o()}catch(t){return void console.error(t)}},_=function(t){if(n.__checkIsValid(t)){var r=[1,2,3,4,5];if(n.__contains(r,e))return void 0===t||t()}},l=function(t){if(n.__checkIsValid(t)){var r=[0,6];if(n.__contains(r,e))return void 0===t||t()}},y=function(t,e){if(n.__checkIsValid(e))try{if(!t.match(o.date))throw r.date;if(t==n.__dateString())return void 0===e||e()}catch(t){return void console.error(t)}},m=function(e,o,i){if(n.__checkIsValid(i)){var a=new Date(e),s=new Date(o);try{if(a>s)throw r.dateGrater;if(a==s)throw r.dateSameDay;if(n.__dateCompare(a,s,t))return void 0===i||i()}catch(t){return void console.error(t)}}},g=function(e,o){if(n.__checkIsValid(o))try{if(!Array.isArray(e))throw r.isNotArray;if(n.__contains(e,t.toISOString().slice(0,10)))return void 0===o||o()}catch(t){return void console.error(t)}},v={Sunday:i,Monday:a,Tuesday:s,Wednesday:c,Thursday:u,Friday:f,Saturday:h,Selects:d,Weekdays:_,Weekend:l,Annual:y,DatesBetween:m,DatesContain:g};return v},t.prototype.at=function(){var t=this.D,e=(this.D.getDay(),this.D.getHours()),r=this.messages(),n=this.helpers(),o=this.formats(),i=function(e,i,a){if(n.__checkIsValid(a))try{if(!e.match(o.time))throw r.time+"at start";if(!i.match(o.time))throw r.time+" at end";var s=t<n.__timeObject(i)&&t>n.__timeObject(e);if(s)return void 0===a||a()}catch(t){return void console.error(t)}},a=function(e,i,a){if(n.__checkIsValid(a))try{if(!e.match(o.time))throw r.time+"at start";if(!i.match(o.time))throw r.time+" at end";var s=t<n.__timeObject(i)&&t>n.__timeObject(e);if(!s)return void 0===a||a()}catch(t){return void console.error(t)}},s=function(t,o){if(n.__checkIsValid(o)){var i=parseInt(t);try{if(i>23)throw r.startHour;if(i===e)return void 0===o||o()}catch(t){return void console.error(t)}}},c=function(t,o,i){if(n.__checkIsValid(i)){var a=parseInt(t),s=parseInt(o);try{if(a>23)throw r.startHour;if(s>23)throw r.endHour;var c=n.__range(s,s-a);if(c.push(t),n.__contains(c,e))return void 0===i||i()}catch(t){return void console.error(t)}}},u=function(t,o){if(n.__checkIsValid(o))try{if(!Array.isArray(t))throw r.isNotArray;if(1!=!t.some(isNaN))throw r.hourFormat;var i=t.map(function(t){return parseInt(t)});if(i.map(function(t){if(t>23)throw r.isNotValidHour}),n.__contains(i,e))return void 0===o||o()}catch(t){return void console.error(t)}},f={Between:i,Unless:a,Hour:s,HoursBetween:c,HourSelects:u};return f},t.prototype.in=function(t){var e=t,r=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),a=this.D.getMonth()+1,s=this.D.getFullYear(),c=function(t,r){if(0!=this._Chain&&n.__checkIsValid(r))try{if(parseInt(t)>31)throw __msg.day;return t==i?void 0!==r?r():1!=e||this:(this._Chain=!1,1==e&&this)}catch(t){return void console.error(t)}},u=function(t,o){if(0!=this._Chain&&n.__checkIsValid(o))try{if(!Array.isArray(t))throw r.isNotArray;var a=t.map(function(t){return parseInt(t)});return n.__contains(a,i)?void 0!==o?o():1!=e||this:(this._Chain=!1,1==e&&this)}catch(t){return void console.error(t)}},f=function(t,o,a){if(0!=this._Chain&&n.__checkIsValid(a))try{var s=parseInt(t),c=parseInt(o);if(s>30)throw r.startDay;if(c>31)throw r.endDay;var u=n.__range(c,c-s);return u.push(t),n.__contains(u,i)?void 0!==a?a():1!=e||this:(this._Chain=!1,1==e&&this)}catch(t){return void console.error(t)}},h=function(t,o){if(0!=this._Chain&&n.__checkIsValid(o))try{if(parseInt(t)>12)throw r.month;var i=t<10?"0"+t:t;return i==a?void 0!==o?o():1!=e||this:(this._Chain=!1,1==e&&this)}catch(t){return void console.error(t)}},d=function(t,o){if(0!=this._Chain&&n.__checkIsValid(o)){if(!Array.isArray(t))throw r.isNotArray;return n.__contains(t,a)?void 0!==o?o():1!=e||this:(this._Chain=!1,1==e&&this)}},_=function(t,i){if(0!=this._Chain&&n.__checkIsValid(i))try{if(!t.toString().match(o.year))throw r.year;return t==s?void 0!==i?i():1!=e||this:(this._Chain=!1,1==e&&this)}catch(t){return void console.error(t)}},l={Day:c,Days:u,DaysBetween:f,Month:h,MonthSelects:d,Year:_};return l},t.prototype.is=function(){var t=this.helpers(),e=this.messages(),r=function(e,r){if(t.__checkIsValid(r)&&e)return void 0===r||r()},n=function(e,r){if(t.__checkIsValid(r)&&!e)return void 0===r||r()},o=function(e,r){if(t.__checkIsValid(r))try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;if(e.toLowerCase()==t.__detectLang())return void 0===r||r()}catch(t){return void console.error(t)}},i=function(e,r){if(t.__checkIsValid(r))try{if("undefined"==typeof window)throw this.messages("Lang").onlyBrowser;var n=t.__detectLang();if(e.toLowerCase()==n.slice(0,2))return void 0===r||r()}catch(t){return void console.error(t)}},a=function(r,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(r))throw e.isNotArray;if(t.__contains(t.__arrayToLower(r),t.__detectLang()))return void 0===n||n()}catch(t){return void console.error(t)}},s=function(r,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(r))throw e.isNotArray;var o=t.__detectLang();if(t.__contains(t.__arrayToLower(r),o.slice(0,2)))return void 0===n||n()}catch(t){return void console.error(t)}},c=function(r,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(r))throw e.isNotArray;if(!t.__contains(t.__arrayToLower(r),t.__detectLang()))return void 0===n||n()}catch(t){return void console.error(t)}},u=function(r,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(r))throw e.isNotArray;var o=t.__detectLang();if(!t.__contains(t.__arrayToLower(r),o.slice(0,2)))return void 0===n||n()}catch(t){return void console.error(t)}},f=function(e){if(t.__checkIsValid(e))try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var r=navigator.userAgent,n=["Windows Phone","iPad","iPhone","iPod","Android"],o=[],i=0;i<n.length;i++)o.push(t.__str_includes(r,n[i]));if(o.indexOf(!0)!=-1)return void 0===e||e()}catch(t){return void console.error(t)}},h={True:r,False:n,Language:o,Lang:i,LanguageSelects:a,LangSelects:s,LanguageExcepts:c,LangExcepts:u,Mobile:f};return h},t.prototype.timer=function(){var t=this.messages(),e=this.helpers(),r=function(r,n,o){var i=e.__typeToMilliseconds(r),a=typeof o;try{if(!i)throw t.timeFormat;if(isNaN(n))throw t.numFormat;if(0===n||"0"===n)throw t.numFormat;if(!e.__contains(["object","function"],a))throw this.messages("type").taskFormat;if("object"===a){if(!("before"in o))throw this.messages("key:before").notExist;if(!("after"in o))throw this.messages("key:after").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;if("function"!=typeof o.after)throw this.messages("after").shouldBeFunction;return o.before(),setTimeout(function(){return o.after()},n*i)}if("function"===a)return setTimeout(function(){return o()},n*i)}catch(t){return void console.error(t)}},n=function(r,n,o){var i=e.__typeToMilliseconds(r),a=typeof o;try{if(!i)throw t.timeFormat;if(isNaN(n))throw t.numFormat;if(0===n||"0"===n)throw t.numFormat;if(!e.__contains(["object","function"],a))throw this.messages("type").taskFormat;if("object"===a){if(!("before"in o))throw this.messages("key:before").notExist;if(!("after"in o))throw this.messages("key:after").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;if("function"!=typeof o.after)throw this.messages("after").shouldBeFunction;return o.before(),setInterval(function(){return o.after()},n*i)}if("function"===a)return setInterval(function(){return o()},n*i)}catch(t){return void console.error(t)}},o={After:r,Every:n};return o},t});
!function(t,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?module.exports=r():t.SelfTimer=r()}(this,function(){"use strict";function t(t){if(void 0===t)this.D=new Date;else{if(t instanceof Date==!1)return void console.error("'date' must be Date type.");this.D=t}}return t.prototype.helpers=function(){var t=this.D;this.D.getDay();return{__checkIsValid:function(t){return"function"==typeof t||void 0==t},__contains:function(t,r){for(var e=t.length;e--;)if(t[e]===r)return!0;return!1},__str_includes:function(t,r){var e=!1;return t.indexOf(r)>=0&&(e=!0),e},__dayOfTheWeekStringToNumber:function(t){return t.map(function(t){return t.replace(/Sun/g,0)}).map(function(t){return t.replace(/Mon/g,1)}).map(function(t){return t.replace(/Tue/g,2)}).map(function(t){return t.replace(/Wed/g,3)}).map(function(t){return t.replace(/Thu/g,4)}).map(function(t){return t.replace(/Fri/g,5)}).map(function(t){return t.replace(/Sat/g,6)}).map(function(t){return parseInt(t)})},__timeObject:function(t){var r=t.split(/:|\s/),e=new Date;return"pm"==r.pop().toLowerCase()&&(r[0]=+r[0]+12),e.setHours(+r.shift()),e.setMinutes(+r.shift()),e},__range:function(t,r){1==arguments.length&&(r=t,t=0);for(var e=[],n=0;n<r;n++)e.push(t-n);return e},__dateCompare:function(t,r,e){return e<r.setDate(r.getDate()+1)&&e>t},__dateString:function(){var r=t.getMonth()+1,e=t.getDate();return r.length<2&&(r="0"+r),e.length<2&&(e="0"+e),[r,e].join("-")},__typeToMilliseconds:function(t){var r;switch(t){case"s":case"sec":case"second":case"seconds":r=1e3;break;case"m":case"min":case"minute":case"minutes":r=6e4;break;default:r=!1}return r},__detectLang:function(){return"undefined"===navigator.userLanguage?navigator.userLanguage.toLowerCase():navigator.language.toLowerCase()},__arrayToLower:function(t){return t.map(function(t){return t.toLowerCase()})}}},t.prototype.messages=function(t){return{day:"Error: A day should be less than 31",month:"Error: month should be untll 12",date:"Error: date format shoud be MM-DD",year:"Error: date format shoud be 20YY",monthBetween:"Error: start of month should be less than end of month",startMin:"Error: start minute should be less than 59",endMin:"Error: end minute should be until 59",minFormat:"Error: minutes should be numberic",isNotValidMin:"Error: minute should be until 59",startHour:"Error: start hour should be less than 23",endHour:"Error: end hour should be until 23",hourFormat:"Error: hours should be numberic",isNotValidHour:"Error: hour should be until 23",startDay:"Error: start day should be less than 30",endDay:"Error: end day should be untill 31",time:"Error: invalid time format. time should be [hh:mm AM or PM]",isNotArray:"Error: first argument shold be Array",dateGrater:"start date should not be grater than end-of -date",dateSameDay:"start and end date are should not be same date ",timeFormat:"Error: time of type formats",numFormat:"Error: num should be numberic",taskFormat:"Error: "+t+" should be object or function",notExist:"Error: "+t+" not exist",shouldBeFunction:"Error: "+t+" is shold be function",onlyBrowser:"Error: "+t+" is just supported web-browser"}},t.prototype.formats=function(){return{date:/^(1[0-2]|[1-9])-([1-9]|[12]\d|3[0-1])$/,year:/^[2][0][1-9]{2}$/,annual:/^[2]{1}[0]{1}[1-3]{1}[0-9]{1}-[01]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,time:/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/}},t.prototype.info=function(){return{version:"1.6.0",method:{on:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Weekdays","Weekend","Selects","Annual","DatesBetween","DatesContain"],at:["Between","Unless","Min","MinBetween","MinSelects","Hour","HoursBetween","HourSelects"],in:["Day","Days","DaysBetween","Month","MonthSelects","Year"],is:["True","False","Language","Lang","LanguageSelects","LangSelects","LanguageExcepts","LangExcepts","Mobile"],timer:["After"]}}},t.prototype.on=function(){var t=this.D,r=this.D.getDay(),e=this.messages(),n=this.helpers(),o=this.formats();return{Sunday:function(t){if(n.__checkIsValid(t)&&0===r)return void 0===t||t()},Monday:function(t){if(n.__checkIsValid(t)&&1===r)return void 0===t||t()},Tuesday:function(t){if(n.__checkIsValid(t)&&2===r)return void 0==t||t()},Wednesday:function(t){if(n.__checkIsValid(t)&&3===r)return void 0===t||t()},Thursday:function(t){if(n.__checkIsValid(t)&&4===r)return void 0===t||t()},Friday:function(t){if(n.__checkIsValid(t)&&5===r)return void 0===t||t()},Saturday:function(t){if(n.__checkIsValid(t)&&6===r)return void 0===t||t()},Selects:function(t,o){if(n.__checkIsValid(o))try{if(!Array.isArray(t))throw e.isNotArray;var i=n.__dayOfTheWeekStringToNumber(t);if(n.__contains(i,r))return void 0===o||o()}catch(t){return void console.error(t)}},Weekdays:function(t){if(n.__checkIsValid(t)){var e=[1,2,3,4,5];if(n.__contains(e,r))return void 0===t||t()}},Weekend:function(t){if(n.__checkIsValid(t)){var e=[0,6];if(n.__contains(e,r))return void 0===t||t()}},Annual:function(t,r){if(n.__checkIsValid(r))try{if(!t.match(o.date))throw e.date;if(t==n.__dateString())return void 0===r||r()}catch(t){return void console.error(t)}},DatesBetween:function(r,o,i){if(n.__checkIsValid(i)){var a=new Date(r),s=new Date(o);try{if(a>s)throw e.dateGrater;if(a==s)throw e.dateSameDay;if(n.__dateCompare(a,s,t))return void 0===i||i()}catch(t){return void console.error(t)}}},DatesContain:function(r,o){if(n.__checkIsValid(o))try{if(!Array.isArray(r))throw e.isNotArray;if(n.__contains(r,t.toISOString().slice(0,10)))return void 0===o||o()}catch(t){return void console.error(t)}}}},t.prototype.at=function(){var t=this.D,r=(this.D.getDay(),this.D.getHours()),e=this.D.getMinutes(),n=this.messages(),o=this.helpers(),i=this.formats();return{Between:function(r,e,a){if(o.__checkIsValid(a))try{if(!r.match(i.time))throw n.time+"at start";if(!e.match(i.time))throw n.time+" at end";if(t<o.__timeObject(e)&&t>o.__timeObject(r))return void 0===a||a()}catch(t){return void console.error(t)}},Unless:function(r,e,a){if(o.__checkIsValid(a))try{if(!r.match(i.time))throw n.time+"at start";if(!e.match(i.time))throw n.time+" at end";if(!(t<o.__timeObject(e)&&t>o.__timeObject(r)))return void 0===a||a()}catch(t){return void console.error(t)}},Min:function(t,r){if(o.__checkIsValid(r)){var i=parseInt(t);try{if(i>59)throw n.startMin;if(i===e)return void 0===r||r()}catch(t){return void console.error(t)}}},MinBetween:function(t,r,i){if(o.__checkIsValid(i)){var a=parseInt(t),s=parseInt(r);try{if(a>59)throw n.startMin;if(s>59)throw n.endMin;var c=o.__range(s,s-a);if(c.push(t),o.__contains(c,e))return void 0===i||i()}catch(t){return void console.error(t)}}},MinSelects:function(t,r){if(o.__checkIsValid(r))try{if(!Array.isArray(t))throw n.isNotArray;if(1!=!t.some(isNaN))throw n.minFormat;var i=t.map(function(t){return parseInt(t)});if(i.map(function(t){if(t>59)throw n.isNotValidMin}),o.__contains(i,e))return void 0===r||r()}catch(t){return void console.error(t)}},Hour:function(t,e){if(o.__checkIsValid(e)){var i=parseInt(t);try{if(i>23)throw n.startHour;if(i===r)return void 0===e||e()}catch(t){return void console.error(t)}}},HoursBetween:function(t,e,i){if(o.__checkIsValid(i)){var a=parseInt(t),s=parseInt(e);try{if(a>23)throw n.startHour;if(s>23)throw n.endHour;var c=o.__range(s,s-a);if(c.push(t),o.__contains(c,r))return void 0===i||i()}catch(t){return void console.error(t)}}},HourSelects:function(t,e){if(o.__checkIsValid(e))try{if(!Array.isArray(t))throw n.isNotArray;if(1!=!t.some(isNaN))throw n.hourFormat;var i=t.map(function(t){return parseInt(t)});if(i.map(function(t){if(t>23)throw n.isNotValidHour}),o.__contains(i,r))return void 0===e||e()}catch(t){return void console.error(t)}}}},t.prototype.in=function(t){var r=t,e=this.messages(),n=this.helpers(),o=this.formats(),i=(this.D,this.D.getDate()),a=this.D.getMonth()+1,s=this.D.getFullYear();return{Day:function(t,e){if(0!=this._Chain&&n.__checkIsValid(e))try{if(parseInt(t)>31)throw __msg.day;return t==i?void 0!==e?e():1!=r||this:(this._Chain=!1,1==r&&this)}catch(t){return void console.error(t)}},Days:function(t,o){if(0!=this._Chain&&n.__checkIsValid(o))try{if(!Array.isArray(t))throw e.isNotArray;var a=t.map(function(t){return parseInt(t)});return n.__contains(a,i)?void 0!==o?o():1!=r||this:(this._Chain=!1,1==r&&this)}catch(t){return void console.error(t)}},DaysBetween:function(t,o,a){if(0!=this._Chain&&n.__checkIsValid(a))try{var s=parseInt(t),c=parseInt(o);if(s>30)throw e.startDay;if(c>31)throw e.endDay;var u=n.__range(c,c-s);return u.push(t),n.__contains(u,i)?void 0!==a?a():1!=r||this:(this._Chain=!1,1==r&&this)}catch(t){return void console.error(t)}},Month:function(t,o){if(0!=this._Chain&&n.__checkIsValid(o))try{if(parseInt(t)>12)throw e.month;return(t<10?"0"+t:t)==a?void 0!==o?o():1!=r||this:(this._Chain=!1,1==r&&this)}catch(t){return void console.error(t)}},MonthSelects:function(t,o){if(0!=this._Chain&&n.__checkIsValid(o)){if(!Array.isArray(t))throw e.isNotArray;return n.__contains(t,a)?void 0!==o?o():1!=r||this:(this._Chain=!1,1==r&&this)}},Year:function(t,i){if(0!=this._Chain&&n.__checkIsValid(i))try{if(!t.toString().match(o.year))throw e.year;return t==s?void 0!==i?i():1!=r||this:(this._Chain=!1,1==r&&this)}catch(t){return void console.error(t)}}}},t.prototype.is=function(){var t=this.helpers(),r=this.messages();return{True:function(r,e){if(t.__checkIsValid(e)&&r)return void 0===e||e()},False:function(r,e){if(t.__checkIsValid(e)&&!r)return void 0===e||e()},Language:function(r,e){if(t.__checkIsValid(e))try{if("undefined"==typeof window)throw this.messages("Language").onlyBrowser;if(r.toLowerCase()==t.__detectLang())return void 0===e||e()}catch(t){return void console.error(t)}},Lang:function(r,e){if(t.__checkIsValid(e))try{if("undefined"==typeof window)throw this.messages("Lang").onlyBrowser;var n=t.__detectLang();if(r.toLowerCase()==n.slice(0,2))return void 0===e||e()}catch(t){return void console.error(t)}},LanguageSelects:function(e,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LanguageSelects").onlyBrowser;if(!Array.isArray(e))throw r.isNotArray;if(t.__contains(t.__arrayToLower(e),t.__detectLang()))return void 0===n||n()}catch(t){return void console.error(t)}},LangSelects:function(e,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LangSelects").onlyBrowser;if(!Array.isArray(e))throw r.isNotArray;var o=t.__detectLang();if(t.__contains(t.__arrayToLower(e),o.slice(0,2)))return void 0===n||n()}catch(t){return void console.error(t)}},LanguageExcepts:function(e,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LanguageExcepts").onlyBrowser;if(!Array.isArray(e))throw r.isNotArray;if(!t.__contains(t.__arrayToLower(e),t.__detectLang()))return void 0===n||n()}catch(t){return void console.error(t)}},LangExcepts:function(e,n){if(t.__checkIsValid(n))try{if("undefined"==typeof window)throw this.messages("LangExcepts").onlyBrowser;if(!Array.isArray(e))throw r.isNotArray;var o=t.__detectLang();if(!t.__contains(t.__arrayToLower(e),o.slice(0,2)))return void 0===n||n()}catch(t){return void console.error(t)}},Mobile:function(r){if(t.__checkIsValid(r))try{if("undefined"==typeof window)throw this.messages("Mobile").onlyBrowser;for(var e=navigator.userAgent,n=["Windows Phone","iPad","iPhone","iPod","Android"],o=[],i=0;i<n.length;i++)o.push(t.__str_includes(e,n[i]));if(-1!=o.indexOf(!0))return void 0===r||r()}catch(t){return void console.error(t)}}}},t.prototype.timer=function(){var t=this.messages(),r=this.helpers();return{After:function(e,n,o){var i=r.__typeToMilliseconds(e),a=typeof o;try{if(!i)throw t.timeFormat;if(isNaN(n))throw t.numFormat;if(0===n||"0"===n)throw t.numFormat;if(!r.__contains(["object","function"],a))throw this.messages("type").taskFormat;if("object"===a){if(!("before"in o))throw this.messages("key:before").notExist;if(!("after"in o))throw this.messages("key:after").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;if("function"!=typeof o.after)throw this.messages("after").shouldBeFunction;return o.before(),setTimeout(function(){return o.after()},n*i)}if("function"===a)return setTimeout(function(){return o()},n*i)}catch(t){return void console.error(t)}},Every:function(e,n,o){var i=r.__typeToMilliseconds(e),a=typeof o;try{if(!i)throw t.timeFormat;if(isNaN(n))throw t.numFormat;if(0===n||"0"===n)throw t.numFormat;if(!r.__contains(["object","function"],a))throw this.messages("type").taskFormat;if("object"===a){if(!("before"in o))throw this.messages("key:before").notExist;if(!("after"in o))throw this.messages("key:after").notExist;if("function"!=typeof o.before)throw this.messages("before").shouldBeFunction;if("function"!=typeof o.after)throw this.messages("after").shouldBeFunction;return o.before(),setInterval(function(){return o.after()},n*i)}if("function"===a)return setInterval(function(){return o()},n*i)}catch(t){return void console.error(t)}}}},t.prototype.check=function(){var t=!0;return{With:function(r){return!0!==r&&(t=!1),this},Done:function(r){var e=typeof r;if("undefined"===e)return!0===t;if("function"===e)return!0===t&&r();throw new Error("Done() of argument should be 'function' or 'empty' .")}}},t});

@@ -26,3 +26,4 @@ const gulp = require("gulp");

"methods/es5/is",
"methods/es5/timer"
"methods/es5/timer",
"utils/check"
];

@@ -29,0 +30,0 @@

{
"name": "self-timer",
"version": "1.5.3",
"version": "1.6.0",
"description": "light-weight callback runner.",

@@ -27,3 +27,3 @@ "main": "./dist/selftimer.min.js",

"gulp-umd": "^0.2.0",
"jest": "^20.0.4",
"jest": "^21.2.1",
"react": "^15.3.2",

@@ -30,0 +30,0 @@ "react-dom": "^15.3.2",

@@ -106,2 +106,3 @@ # self-timer.js

- Between(), Unless()
- Min(), MinBetween(), MinSelects()
- Hour(), HoursBetween(), HourSelects()

@@ -108,0 +109,0 @@

@@ -252,2 +252,6 @@ ;(function(root, factory) {

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -287,3 +291,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -305,3 +309,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -558,2 +571,3 @@ is: [

var _hour = this.D.getHours();
var _minute = this.D.getMinutes();
var _msg = this.messages();

@@ -623,2 +637,70 @@ var _h = this.helpers();

var Min = function(minute, task) {
if (_h.__checkIsValid(task)) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
if (time === _minute) return task !== undefined ? task() : true;
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
} // ! Minute()
var MinBetween = function(from, to, task) {
if (_h.__checkIsValid(task)) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
if (_h.__contains(arr, _minute)) {
return task !== undefined ? task() : true;
} // ! if()
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinutesBetween()
var MinSelects = function(minutes, task) {
if (_h.__checkIsValid(task)) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidMin;
});
if (_h.__contains(array, _minute)) {
return task !== undefined ? task() : true;
} // ! if
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinuteSelects()
/**

@@ -712,2 +794,5 @@ * [ at().Hour description]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -1268,3 +1353,45 @@ HoursBetween: HoursBetween,

/**
* [ With description]
* @param {[ Boolean ]} val
*/
SelfTimer.prototype.check = function() {
// Private Variable
var _Flag = true;
/**
* @param {[ Any ]} val [ true || empty]
* @return this
*/
var With = function(val) {
if (val !== true) _Flag = false;
return this;
}; // ! With
/**
* @param {[ Function ]} task
* @return {[ Function ]} || {[ Bool ]}
*/
var Done = function(task) {
var callback = typeof task;
if (callback === "undefined") {
return _Flag === true ? true : false;
} else if (callback === "function") {
return _Flag === true ? task() : false;
} else {
throw new Error("Done() of argument should be 'function' or 'empty' .");
}
}; // ! Done
var REGISTER = {
With: With,
Done: Done
}; // REGISTER
return REGISTER;
};
return SelfTimer;
}));

@@ -243,2 +243,6 @@ "use strict";

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -278,3 +282,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -296,3 +300,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -549,2 +562,3 @@ is: [

var _hour = this.D.getHours();
var _minute = this.D.getMinutes();
var _msg = this.messages();

@@ -614,2 +628,70 @@ var _h = this.helpers();

var Min = function(minute, task) {
if (_h.__checkIsValid(task)) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
if (time === _minute) return task !== undefined ? task() : true;
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
} // ! Minute()
var MinBetween = function(from, to, task) {
if (_h.__checkIsValid(task)) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
if (_h.__contains(arr, _minute)) {
return task !== undefined ? task() : true;
} // ! if()
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinutesBetween()
var MinSelects = function(minutes, task) {
if (_h.__checkIsValid(task)) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidMin;
});
if (_h.__contains(array, _minute)) {
return task !== undefined ? task() : true;
} // ! if
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinuteSelects()
/**

@@ -703,2 +785,5 @@ * [ at().Hour description]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -1258,1 +1343,43 @@ HoursBetween: HoursBetween,

}; // ! SelfTimer.prototype.timer
/**
* [ With description]
* @param {[ Boolean ]} val
*/
SelfTimer.prototype.check = function() {
// Private Variable
var _Flag = true;
/**
* @param {[ Any ]} val [ true || empty]
* @return this
*/
var With = function(val) {
if (val !== true) _Flag = false;
return this;
}; // ! With
/**
* @param {[ Function ]} task
* @return {[ Function ]} || {[ Bool ]}
*/
var Done = function(task) {
var callback = typeof task;
if (callback === "undefined") {
return _Flag === true ? true : false;
} else if (callback === "function") {
return _Flag === true ? task() : false;
} else {
throw new Error("Done() of argument should be 'function' or 'empty' .");
}
}; // ! Done
var REGISTER = {
With: With,
Done: Done
}; // REGISTER
return REGISTER;
};

@@ -252,2 +252,6 @@ ;(function(root, factory) {

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -287,3 +291,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -305,3 +309,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -571,2 +584,3 @@ is: [

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -639,3 +653,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -726,2 +815,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -728,0 +820,0 @@ HoursBetween: HoursBetween,

@@ -253,2 +253,6 @@ !function(e){function n(){}function t(e,n){return function(){e.apply(n,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function i(e,n){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(n):(e._handled=!0,void o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null===t)return void(1===e._state?r:u)(n.promise,e._value);var o;try{o=t(e._value)}catch(i){return void u(n.promise,i)}r(n.promise,o)}))}function r(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var i=n.then;if(n instanceof o)return e._state=3,e._value=n,void f(e);if("function"==typeof i)return void s(t(i,n),e)}e._state=1,e._value=n,f(e)}catch(r){u(e,r)}}function u(e,n){e._state=2,e._value=n,f(e)}function f(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;n<t;n++)i(e,e._deferreds[n]);e._deferreds=null}function c(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}function s(e,n){var t=!1;try{e(function(e){t||(t=!0,r(n,e))},function(e){t||(t=!0,u(n,e))})}catch(o){if(t)return;t=!0,u(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var o=new this.constructor(n);return i(this,new c(e,t,o)),o},o.all=function(e){var n=Array.prototype.slice.call(e);return new o(function(e,t){function o(r,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var f=u.then;if("function"==typeof f)return void f.call(u,function(e){o(r,e)},t)}n[r]=u,0===--i&&e(n)}catch(c){t(c)}}if(0===n.length)return e([]);for(var i=n.length,r=0;r<n.length;r++)o(r,n[r])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(n,t){for(var o=0,i=e.length;o<i;o++)e[o].then(n,t)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},o._setImmediateFn=function(e){o._immediateFn=e},o._setUnhandledRejectionFn=function(e){o._unhandledRejectionFn=e},"undefined"!=typeof module&&module.exports?module.exports=o:e.Promise||(e.Promise=o)}(this);

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -288,3 +292,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -306,3 +310,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -572,2 +585,3 @@ is: [

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -640,3 +654,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -727,2 +816,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -729,0 +821,0 @@ HoursBetween: HoursBetween,

@@ -243,2 +243,6 @@ "use strict";

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -278,3 +282,3 @@ endHour: "Error: end hour should be until 23",

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -296,3 +300,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -562,2 +575,3 @@ is: [

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -630,3 +644,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -717,2 +806,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -719,0 +811,0 @@ HoursBetween: HoursBetween,

@@ -12,2 +12,3 @@ /**

var _hour = this.D.getHours();
var _minute = this.D.getMinutes();
var _msg = this.messages();

@@ -77,2 +78,70 @@ var _h = this.helpers();

var Min = function(minute, task) {
if (_h.__checkIsValid(task)) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
if (time === _minute) return task !== undefined ? task() : true;
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
} // ! Minute()
var MinBetween = function(from, to, task) {
if (_h.__checkIsValid(task)) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
if (_h.__contains(arr, _minute)) {
return task !== undefined ? task() : true;
} // ! if()
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinutesBetween()
var MinSelects = function(minutes, task) {
if (_h.__checkIsValid(task)) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidMin;
});
if (_h.__contains(array, _minute)) {
return task !== undefined ? task() : true;
} // ! if
} catch (e) {
console.error(e);
return;
} // ! Exception
} // ! if()
}; // ! MinuteSelects()
/**

@@ -166,2 +235,5 @@ * [ at().Hour description]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -168,0 +240,0 @@ HoursBetween: HoursBetween,

@@ -13,2 +13,3 @@ /**

var _day = this.D.getDay();
var _minute = this.D.getMinutes();
var _hour = this.D.getHours();

@@ -81,3 +82,78 @@ var _msg = this.messages();

var Min = function(minute) {
return new Promise(function(resolve, reject) {
var time = parseInt(minute);
try {
if (time > 59) throw _msg.startMin;
return time === _minute
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! Hour()
/**
* [ at().HoursBetween description ]
* @param {[ Integer ]} from [ Start hour 0-23 ]
* @param {[ Integer ]} to [ End hour 0 - 23 ]
* @return {[ Resolve ]}
*/
var MinBetween = function(from, to) {
return new Promise(function(resolve, reject) {
var start = parseInt(from);
var end = parseInt(to);
try {
if (start > 59) throw _msg.startMin;
if (end > 59) throw _msg.endMin;
var arr = _h.__range(end, end - start);
arr.push(from);
return _h.__contains(arr, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HoursBetween()
var MinSelects = function(minutes, task) {
return new Promise(function(resolve, reject) {
try {
if (!Array.isArray(minutes)) throw _msg.isNotArray;
// check array elements if numberic
if (!minutes.some(isNaN) != true) throw _msg.minFormat;
var array = minutes.map(function(res) {
// convert elemetnts to Integer in array
return parseInt(res);
});
array.map(function(res) {
// check elements if valid minute format
if (res > 59) throw _msg.isNotValidHour;
});
return _h.__contains(array, _minute)
? resolve(true)
: _Condition === true ? reject(false) : false;
} catch (e) {
console.error(e);
return;
} // ! Exception
}); // ! Promise()
}; // ! HourSelects()
/**
* [ at().Hour description]

@@ -168,2 +244,5 @@ * @param {[ Integer ]} hour [ 0 - 23 ]

Unless: Unless,
Min: Min,
MinBetween: MinBetween,
MinSelects: MinSelects,
Hour: Hour,

@@ -170,0 +249,0 @@ HoursBetween: HoursBetween,

@@ -7,3 +7,3 @@ /**

return {
version: "1.5.3",
version: "1.6.0",
method: {

@@ -25,3 +25,12 @@ on: [

],
at: ["Between", "Unless", "Hour", "HoursBetween", "HourSelects"],
at: [
"Between",
"Unless",
"Min",
"MinBetween",
"MinSelects",
"Hour",
"HoursBetween",
"HourSelects"
],
in: ["Day", "Days", "DaysBetween", "Month", "MonthSelects", "Year"],

@@ -28,0 +37,0 @@ is: [

@@ -8,2 +8,6 @@ SelfTimer.prototype.messages = function(val) {

monthBetween: "Error: start of month should be less than end of month",
startMin: "Error: start minute should be less than 59",
endMin: "Error: end minute should be until 59",
minFormat: "Error: minutes should be numberic",
isNotValidMin: "Error: minute should be until 59",
startHour: "Error: start hour should be less than 23",

@@ -10,0 +14,0 @@ endHour: "Error: end hour should be until 23",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc