lib/connect-thumbs.js
function parseOptions(options) {

  ttl = options.ttl || (3600 * 24); // cache for 1 day by default.
  tmpCacheTTL = options.tmpCacheTTL || 5; // small by default
  decodeFn = options.decodeFn || exports.decodeURL;
  presets  = options.presets || defaultPresets();

  tmpDir   = options.tmpDir || '/tmp/nodethumbnails';

  var rootPath = options.rootPath || '/thumbs';
  if (rootPath[0] === '/') { rootPath = rootPath.substring(1); } // be forgiving to user errors!

  var allowedExtensions = options.allowedExtensions || ['gif', 'png', 'jpg', 'jpeg'];
  for (var i=0; i < allowedExtensions.length; i++) {
    // be forgiving to user errors!
    if (allowedExtensions[i][0] === '.') {
      allowedExtensions[i] = allowedExtensions[i].substring(1);
    }
  }
  var szExtensions = allowedExtensions.join('|');

  // Example: http://example.com/thumbs/small/images/AB23DC16Hash.jpg
  regexp = new RegExp('^\/' + rootPath.replace(/\//ig, '\\/') +
    '\/([A-Za-z0-9_]+)\/images\/([%\.\-A-Za-z0-9_=\+]+)\.(?:' + szExtensions + ')$', 'i');
}
function parseOptions(options) {

  ttl = options.ttl || (3600 * 24); // cache for 1 day by default.
  tmpCacheTTL = options.tmpCacheTTL || 5; // small by default
  decodeFn = options.decodeFn || exports.decodeURL;
  presets  = options.presets || defaultPresets();

  tmpDir   = options.tmpDir || '/tmp/nodethumbnails';

  var rootPath = options.rootPath || '/thumbs';
  if (rootPath[0] === '/') { rootPath = rootPath.substring(1); } // be forgiving to user errors!

  var allowedExtensions = options.allowedExtensions || ['gif', 'png', 'jpg', 'jpeg'];
  for (var i=0; i < allowedExtensions.length; i++) {
    // be forgiving to user errors!
    if (allowedExtensions[i][0] === '.') {
      allowedExtensions[i] = allowedExtensions[i].substring(1);
    }
  }
  var szExtensions = allowedExtensions.join('|');

  // Example: http://example.com/thumbs/small/images/AB23DC16Hash.jpg
  regexp = new RegExp('^\/' + rootPath.replace(/\//ig, '\\/') +
    '\/([A-Za-z0-9_]+)\/images\/([%\.\-A-Za-z0-9_=\+]+)\.(?:' + szExtensions + ')$', 'i');
}
function parseOptions ( options ) { ttl = options . ttl || ( 3600 * 24 ) ; // cache for 1 day by default. tmpCacheTTL = options . tmpCacheTTL || 5 ; // small by default decodeFn = options . decodeFn || exports . decodeURL ; presets = options . presets || defaultPresets ( ) ; tmpDir = options . tmpDir || '/tmp/nodethumbnails' ; var rootPath = options . rootPath || '/thumbs' ; if ( rootPath [ 0 ] === '/' ) { rootPath = rootPath . substring ( 1 ) ; } // be forgiving to user errors! var allowedExtensions = options . allowedExtensions || [ 'gif' , 'png' , 'jpg' , 'jpeg' ] ; for ( var i = 0 ; i < allowedExtensions . length ; i ++ ) { // be forgiving to user errors! if ( allowedExtensions [ i ] [ 0 ] === '.' ) { allowedExtensions [ i ] = allowedExtensions [ i ] . substring ( 1 ) ; } } var szExtensions = allowedExtensions . join ( '|' ) ; // Example: http://example.com/thumbs/small/images/AB23DC16Hash.jpg regexp = new RegExp ( '^\/' + rootPath . replace ( / \/ / ig , '\\/' ) + '\/([A-Za-z0-9_]+)\/images\/([%\.\-A-Za-z0-9_=\+]+)\.(?:' + szExtensions + ')$' , 'i' ) ; }
Merge user-provided options with the sensible defaults.
@param options
Merge user - provided options with the sensible defaults .