From 622161af9bd9e114a3fc1e6465f8347bb8095da4 Mon Sep 17 00:00:00 2001 From: kfiroo Date: Wed, 13 Sep 2017 17:00:49 +0300 Subject: [PATCH] move default options into scope --- ImageCacheManager.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ImageCacheManager.js b/ImageCacheManager.js index 6fd5702..08086aa 100644 --- a/ImageCacheManager.js +++ b/ImageCacheManager.js @@ -4,18 +4,17 @@ const _ = require('lodash'); const fsUtils = require('./utils/fsUtils'); const pathUtils = require('./utils/pathUtils'); - const MemoryCache = require('react-native-clcasher/MemoryCache').default; -const defaultDefaultOptions = { - headers: {}, - ttl: 60 * 60 * 24 * 14, // 2 weeks - useQueryParamsInCacheKey: false, - cacheLocation: fsUtils.getCacheDir(), - allowSelfSignedSSL: false, -}; +module.exports = (defaultOptions = {}, urlCache = MemoryCache, fs = fsUtils, path = pathUtils) => { -module.exports = (defaultOptions = defaultDefaultOptions, urlCache = MemoryCache, fs = fsUtils, path = pathUtils) => { + const defaultDefaultOptions = { + headers: {}, + ttl: 60 * 60 * 24 * 14, // 2 weeks + useQueryParamsInCacheKey: false, + cacheLocation: fs.getCacheDir(), + allowSelfSignedSSL: false, + }; // apply default options _.defaults(defaultOptions, defaultDefaultOptions);