GT2/GT2-Android/node_modules/jsonwebtoken/.history/lib/timespan_20170513162630.js

17 lines
471 B
JavaScript
Raw Normal View History

var ms = require('ms');
module.exports = function (timeOffset, currentTimestamp) {
currentTimestamp = iat || Math.floor(Date.now() / 1000);
if (typeof timeOffset === 'string') {
var milliseconds = ms(timeOffset);
if (typeof milliseconds === 'undefined') {
return;
}
return Math.floor(currentTimestamp + milliseconds / 1000);
} else if (typeof timeOffset === 'number') {
return currentTimestamp + timeOffset;
} else {
return;
}
};