Skip to content

Commit

Permalink
fix: Do not reference this in module (#107)
Browse files Browse the repository at this point in the history
Co-authored-by: Trygve Lie <trygve.lie@finn.no>
trygve-lie and Trygve Lie authored May 2, 2023
1 parent f0d2562 commit d7392d2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
'use strict';

module.exports.calculateExpire = (ttl = 0) => {
const calculateExpire = (ttl = 0) => {
if (ttl === Infinity) {
return ttl;
}
return Date.now() + ttl;
};
module.exports.calculateExpire = calculateExpire;

module.exports.expired = (expires = 0, now = Date.now()) => {
const expired = (expires = 0, now = Date.now()) => {
if (expires === Infinity) {
return false;
}
return expires < now;
};
module.exports.expired = expired;

module.exports.isEmpty = (value) => {
const isEmpty = (value) => {
return (value === null || value === undefined);
};
module.exports.isEmpty = isEmpty;

module.exports.isNotEmpty = (value) => {
return !this.isEmpty(value);
const isNotEmpty = (value) => {
return !isEmpty(value);
};
module.exports.isNotEmpty = isNotEmpty;

module.exports.isFunction = (value) => {
const isFunction = (value) => {
return ({}.toString.call(value) === '[object Function]');
};
module.exports.isFunction = isFunction;

0 comments on commit d7392d2

Please sign in to comment.