UNPKG

postcss-theme-fold

Version:

[![NPM Version][npm-img]][npm-url] [![github (ci)][github-ci]][github-ci]

15 lines (14 loc) 428 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFromCache = void 0; const cache = { value: null, key: null }; function getFromCache(key, fx) { // Serialize key for easy compare. key = JSON.stringify(key); if (cache.value === null || cache.key !== key) { cache.value = fx(); cache.key = key; } return cache.value; } exports.getFromCache = getFromCache;