Jacob Heun 993ca1cb85
feat: timeline and close checking (#55)
* feat: add test to validate timeline presence

* feat: add test and docs for close and timeline

* feat: add filter test

* docs: dont reference go, it's not relevant
2019-09-19 13:34:25 +02:00

17 lines
423 B
JavaScript

'use strict'
module.exports = {
/**
* A tick is considered valid if it happened between now
* and `ms` milliseconds ago
* @param {number} date Time in ticks
* @param {number} ms max milliseconds that should have expired
* @returns {boolean}
*/
isValidTick: function isValidTick (date, ms = 5000) {
const now = Date.now()
if (date > now - ms && date <= now) return true
return false
}
}