Code coverage report for nodash/nodash.js

Statements: 97.06% (66 / 68)      Branches: 92.59% (25 / 27)      Functions: 100% (4 / 4)      Lines: 97.01% (65 / 67)      Ignored: none     

All files » nodash/ » nodash.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107    1     5     5             5   5   5   5 5   5 5 5 5   5 5 5 5 5 5 5 5 5 5 5 5 5 5   5 5 5 5 5 5   5 5     5 41 41 41 41 41 1   40 4   40 6 3   6 2   6   40 11120 40   11080 11080 4431     40     5   5 5   5 5     5     1   1   1      
/* vim: set et sw=2 ts=2: */
 
function makeNodash(options) {
  'use strict';
 
  options = options || {};
 
  // Basic ECMA Script 5 checks (if these fail pull in `es5-shim`).
  Iif (typeof Object.keys !== 'function' || Object.keys({ x: 7 })[0] !== 'x' ||
      typeof Array.isArray !== 'function' || !Array.isArray([]) ||
      typeof Array.prototype.forEach !== 'function') {
    throw new Error('ES5 environment required (`es5-shim` will do).');
  }
 
  // This is the object the nodash functions will be attached to.
  var Nodash = {};
  
  var register = require('./lib/register')(Nodash, options);
 
  register('curried', require('./lib/curried'));
 
  register(require('./lib/type'));
  register(require('./lib/function'));
  
  register(require('./lib/Thunk'));
  register(require('./lib/Tuple'));
  register(require('./lib/List'));
  register(require('./lib/Stream'));
 
  register(require('./lib/boolean'));
  register(require('./lib/eq'));
  register(require('./lib/ord'));
  register(require('./lib/char'));
  register(require('./lib/num'));
  register(require('./lib/integral'));
  register(require('./lib/fractional'));
  register(require('./lib/floating'));
  register(require('./lib/realfrac'));
  register(require('./lib/numeric'));
  register(require('./lib/string'));
  register(require('./lib/control'));
  register(require('./lib/object'));
  register(require('./lib/match'));
 
  register(require('./lib/coll/map'));
  register(require('./lib/coll/fold'));
  register(require('./lib/coll/base'));
  register(require('./lib/coll/zipWith'));
  register(require('./lib/coll/extra'));
  register(require('./lib/collection'));
  
  register(require('./lib/Maybe'));
  register(require('./lib/Either'));
 
  
  register('install', function (mountpoint) {
    var options = arguments[1];
    var nodashObject = Nodash;
    var prefix = '';
    var postfix = '';
    if (!mountpoint) {
      return Nodash;
    }
    if (options) {
      nodashObject = makeNodash(options);
    }
    if (Nodash.isArray(mountpoint)) {
      if (Nodash.isString(mountpoint[0])) {
        prefix = [].shift.call(mountpoint);
      }
      if (Nodash.isString(mountpoint[1])) {
        postfix = mountpoint[1];
      }
      mountpoint = mountpoint[0] || {};
    }
    Nodash.each(function (func, name) {
      if (name[0] === '_') {
        return;
      }
      var key = prefix + name + postfix;
      if (!(key in mountpoint)) {
        mountpoint[key] = func;
      }
    }, nodashObject);
    return mountpoint;
  });
 
  register('register', register);
 
  delete Nodash.Thunk;
  delete Nodash.resolveThunk;
  
  register(['freeze', function (freeze) {
    freeze(Nodash); return {};
  }]);
  
  return Nodash;
}
 
var Nodash = makeNodash();
 
module.exports = Nodash;
 
Iif (typeof window !== 'undefined') {
  window.Nodash = Nodash;
}