memoize-fs
Advanced tools
Comparing version 1.0.1 to 1.0.2
22
index.js
'use strict'; | ||
var _ = require('lodash'), | ||
Promise = require('es6-promise').Promise, | ||
var Promise = require('es6-promise').Promise, | ||
mkdirp = require('mkdirp'), | ||
@@ -71,3 +70,3 @@ fs = require('fs'), | ||
var optExt = _.extend({}, opt); | ||
var optExt = opt || {}; | ||
@@ -82,4 +81,4 @@ if (typeof fn !== 'function') { throw new Error('fn of type function expected'); } | ||
var memFn = function () { | ||
var args = arguments, | ||
fnaCb = _.last(args); | ||
var args = Array.prototype.slice.call(arguments), | ||
fnaCb = args.length ? args[args.length - 1] : undefined; | ||
@@ -110,8 +109,8 @@ if (typeof fnaCb === 'function' && fnaCb.length > 0) { | ||
function processFnAsync() { | ||
var fnaArgs = _.initial(args), | ||
fnaCb = _.last(args); | ||
args.pop(); | ||
fnaArgs.push(function (/* err, result... */) { | ||
var cbErr = _.first(arguments), | ||
cbArgs = _.rest(arguments); | ||
args.push(function (/* err, result... */) { | ||
var cbErr = arguments[0], | ||
cbArgs = Array.prototype.slice.call(arguments); | ||
cbArgs.shift(); | ||
if (cbErr) { | ||
@@ -126,3 +125,3 @@ // if we have an exception we don't cache anything | ||
}); | ||
fn.apply(null, fnaArgs); | ||
fn.apply(null, args); | ||
} | ||
@@ -180,3 +179,2 @@ | ||
function processFnAsync() { | ||
var fnaCb = _.last(args); | ||
resolve(fnaCb.apply(null, parseResult(data))); | ||
@@ -183,0 +181,0 @@ } |
{ | ||
"name": "memoize-fs", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "memoize/cache in file system solution for Node.js", | ||
@@ -28,3 +28,2 @@ "author": "Boris Diakur <contact@borisdiakur.com> (https://github.com/borisdiakur)", | ||
"es6-promise": "^2.1.0", | ||
"lodash": "^3.7.0", | ||
"mkdirp": "~0.5.0", | ||
@@ -31,0 +30,0 @@ "rimraf": "~2.3.0" |
3
24791
214
- Removedlodash@^3.7.0
- Removedlodash@3.10.1(transitive)