Code coverage report for nodash/lib/Thunk.js

Statements: 100% (14 / 14)      Branches: 100% (2 / 2)      Functions: 100% (5 / 5)      Lines: 100% (14 / 14)      Ignored: none     

All files » nodash/lib/ » Thunk.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      1   7   1 174 174 153 153 95   153     7   7         2 1   1          
/* vim: set et sw=2 ts=2: */
'use strict';
 
module.exports = function () {
  
  var Nodash = this;
 
  function Thunk(generator) {
    var self = this;
    this.get = function () {
      var value = generator();
      self.get = function () {
        return value;
      };
      return value;
    };
  }
  Thunk.__type = 'thunk';
 
  return {
    
    Thunk: Thunk,
 
    resolveThunk: function (x) {
      if (Nodash.is(Thunk, x)) {
        return x.get();
      }
      return x;
    }
 
  };
};