Skip to content

Commit

Permalink
move default options into scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kfiroo committed Sep 13, 2017
1 parent 3b73e8b commit 622161a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ImageCacheManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 622161a

Please sign in to comment.