anigo-anime-api
Version:
Anigo Anime API scrapes data from gogoanime and animixplay
20 lines (19 loc) • 529 B
JavaScript
function wrap (type, index, func) {
const cache = options.cache
const group = cache[type]
if (group.expire > 0 || group.permanent) {
return new Promise(function (resolve, reject) {
addIf(cache, type, index, {
done: resolve,
add: function (done) {
return func().then(done).catch(reject)
}
})
})
} else {
return func()
}
}
module.exports = function (type, index, func) {
return wrap(type, index, func)
}