'use strict';

var fs = require('fs');
var path = require('path');

function Fs () {
  this._map = {};
}

Fs.prototype = {
  ext: function (file, ext, exts) {
    exts = exts || [ext];
    return exts.indexOf((path.extname(file) || '.').split('.')[1]) === -1 ? file + '.' + ext : file;
  },

  map: function (map, path) {
    if (typeof map === 'object') {
      for (var a in map) {
        if (map.hasOwnProperty(a)) {
          this._map[a] = map[a];
        }
      }
    } else {
      this._map[map] = path;
    }

    return this;
  },

  module: function (mod, relativeTo) {
    if (mod.indexOf(path.sep) !== -1) {
      return;
    }

    var foundFile;
    var dirs = __dirname.split(path.sep);
    var lookups = {
      'bower_components': 'bower.json',
      'node_modules': 'package.json'
    };
    relativeTo = relativeTo ? path.dirname(relativeTo) : process.cwd();

    check:
    for (var a = 0; a < dirs.length; a++) {
      for (var b in lookups) {
        if (lookups.hasOwnProperty(b)) {
          var checkDir = path.join(relativeTo, new Array(a).join('../'), b, mod);
          var packageFile = path.join(checkDir, lookups[b]);

          if (fs.existsSync(packageFile)) {
            var pkg = require(packageFile);
            var pkgMain = path.join(checkDir, pkg.main);

            if (pkg.main && fs.existsSync(pkgMain)) {
              foundFile = pkgMain;
              break check;
            }
          }
        }
      }
    }

    return foundFile;
  },

  resolve: function (file, relativeTo) {
    return (this._map[file] && path.resolve(this._map[file])) ||
      (path.isAbsolute(file) && file) ||
      this.module(file, relativeTo) ||
      this.relative(file, relativeTo);
  },

  relative: function (file, relativeTo) {
    return relativeTo ? path.resolve(path.dirname(relativeTo), file) : path.resolve(file);
  }
};

module.exports = Fs;

@@ -143,14 +143,26 @@
 le, 
-ext, e
+defaultExt, validE
 xts)
@@ -172,25 +172,103 @@
     
-e
+var fileE
 xt
-s
  = 
-exts %7C%7C %5Be
+(path.extname(file) %7C%7C '.').split('.')%5B1%5D;%0A    validExts = validExts %7C%7C %5BdefaultE
 xt%5D;
@@ -279,17 +279,22 @@
  return 
-e
+validE
 xts.inde
@@ -301,49 +301,15 @@
 xOf(
-(path.extname(file) %7C%7C '.').split('.')%5B1%5D
+fileExt
 ) ==
@@ -314,16 +314,22 @@
 === -1 ?
+%0A     
  file + 
@@ -338,13 +338,26 @@
 ' + 
-ext :
+defaultExt :%0A     
  fil

Refactor ext method so that it's more readable and its intent is more clear.