redux-ab-test
Version:
A/B testing React components with Redux and debug tools. Isomorphic with a simple, universal interface. Well documented and lightweight. Tested in popular browsers and Node.js. Includes helpers for React, Redux, and Segment.io
28 lines (24 loc) • 485 B
JavaScript
/** @flow */
//
// Helpers:
//
export default function createCacheStore() {
let cache = {};
const noopStore = {
cache: () => cache,
getItem: (key:string):any => {
return cache[key];
},
setItem: (key:string, value:any):void => {
cache[key] = value;
},
removeItem: (key:string):void => {
delete cache[key];
},
clear: ():void => {
cache = {};
},
};
return noopStore;
}
export const cacheStore = createCacheStore();