nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions

73
node_modules/mem/index.js generated vendored
View File

@@ -1,47 +1,78 @@
'use strict';
const mimicFn = require('mimic-fn');
const isPromise = require('p-is-promise');
const mapAgeCleaner = require('map-age-cleaner');
const cacheStore = new WeakMap();
const defaultCacheKey = function (x) {
if (arguments.length === 1 && (x === null || x === undefined || (typeof x !== 'function' && typeof x !== 'object'))) {
return x;
const defaultCacheKey = (...args) => {
if (args.length === 0) {
return '__defaultKey';
}
return JSON.stringify(arguments);
if (args.length === 1) {
const [firstArgument] = args;
if (
firstArgument === null ||
firstArgument === undefined ||
(typeof firstArgument !== 'function' && typeof firstArgument !== 'object')
) {
return firstArgument;
}
}
return JSON.stringify(args);
};
module.exports = (fn, opts) => {
opts = Object.assign({
module.exports = (fn, options) => {
options = Object.assign({
cacheKey: defaultCacheKey,
cache: new Map()
}, opts);
cache: new Map(),
cachePromiseRejection: false
}, options);
const memoized = function () {
const cache = cacheStore.get(memoized);
const key = opts.cacheKey.apply(null, arguments);
if (typeof options.maxAge === 'number') {
mapAgeCleaner(options.cache);
}
const {cache} = options;
options.maxAge = options.maxAge || 0;
const setData = (key, data) => {
cache.set(key, {
data,
maxAge: Date.now() + options.maxAge
});
};
const memoized = function (...args) {
const key = options.cacheKey(...args);
if (cache.has(key)) {
const c = cache.get(key);
if (typeof opts.maxAge !== 'number' || Date.now() < c.maxAge) {
return c.data;
}
return c.data;
}
const ret = fn.apply(null, arguments);
const ret = fn.call(this, ...args);
cache.set(key, {
data: ret,
maxAge: Date.now() + (opts.maxAge || 0)
});
setData(key, ret);
if (isPromise(ret) && options.cachePromiseRejection === false) {
// Remove rejected promises from cache unless `cachePromiseRejection` is set to `true`
ret.catch(() => cache.delete(key));
}
return ret;
};
mimicFn(memoized, fn);
try {
// The below call will throw in some host environments
// See https://github.com/sindresorhus/mimic-fn/issues/10
mimicFn(memoized, fn);
} catch (_) {}
cacheStore.set(memoized, opts.cache);
cacheStore.set(memoized, options.cache);
return memoized;
};