diff --git a/configure/request-next.js b/configure/request-next.js
index 490d472..a720c42 100644
--- a/configure/request-next.js
+++ b/configure/request-next.js
@@ -1,9 +1,10 @@
'use strict';
var core = require('../'),
- isArray = require('lodash/isArray'),
- isFunction = require('lodash/isFunction'),
- isObjectLike = require('lodash/isObjectLike');
+ helpers = require('../lib/helpers'),
+ isArray = Array.isArray,
+ isFunction = helpers.isFunction,
+ isObjectLike = helpers.isObjectLike;
module.exports = function (options) {
diff --git a/configure/request2.js b/configure/request2.js
index 0cba240..0ac839a 100644
--- a/configure/request2.js
+++ b/configure/request2.js
@@ -1,9 +1,10 @@
'use strict';
var core = require('../'),
- isArray = require('lodash/isArray'),
- isFunction = require('lodash/isFunction'),
- isObjectLike = require('lodash/isObjectLike');
+ helpers = require('../lib/helpers'),
+ isArray = Array.isArray,
+ isFunction = helpers.isFunction,
+ isObjectLike = helpers.isObjectLike;
module.exports = function (options) {
diff --git a/gulpfile.js b/gulpfile.js
index 77a38a5..383d77c 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -8,7 +8,7 @@ var chalk = require('chalk');
var rimraf = require('rimraf');
var coveralls = require('gulp-coveralls');
var eslint = require('gulp-eslint');
-var _ = require('lodash');
+var flatten = require('lodash.flatten');
var chai = require('chai');
global.expect = chai.expect;
@@ -27,7 +27,7 @@ gulp.task('dev', ['watch', 'validate']);
gulp.task('watch', function () {
- gulp.watch(_.flatten([
+ gulp.watch(flatten([
paths.libJsFiles,
paths.specFiles,
paths.fixtureFiles,
@@ -36,7 +36,7 @@ gulp.task('watch', function () {
'validate'
]);
- gulp.watch(_.flatten([
+ gulp.watch(flatten([
paths.eslintrc
]), [
'lint'
@@ -50,7 +50,7 @@ gulp.task('validate', function (done) {
gulp.task('lint', function () {
- return gulp.src(_.flatten([
+ return gulp.src(flatten([
paths.libJsFiles,
paths.gulpfile,
paths.specFiles,
diff --git a/lib/helpers.js b/lib/helpers.js
new file mode 100644
index 0000000..b2729e6
--- /dev/null
+++ b/lib/helpers.js
@@ -0,0 +1,89 @@
+'use strict';
+
+/*
+The following code is extracted and adapted from the lodash library.
+It is protected by the the MIT License.
+
+Copyright JS Foundation and other contributors
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+var
+ asyncTag = '[object AsyncFunction]',
+ funcTag = '[object Function]',
+ genTag = '[object GeneratorFunction]',
+ proxyTag = '[object Proxy]',
+ nullTag = '[object Null]',
+ stringTag = '[object String]',
+ undefinedTag = '[object Undefined]';
+
+function baseGetTag(value) {
+ if (value === undefined) {
+ return undefinedTag;
+ }
+
+ if (value === null) {
+ return nullTag;
+ }
+
+ return Object.prototype.toString.call(value);
+}
+
+function isObject(value) {
+ var type = typeof value;
+ return value !== undefined && value !== null && (type === 'object' || type === 'function');
+}
+
+function isFunction(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ var tag = baseGetTag(value);
+ return tag === funcTag || tag === genTag || tag === asyncTag || tag === proxyTag;
+}
+
+function isObjectLike(value) {
+ return value !== undefined && value !== null && typeof value === 'object';
+}
+
+function isString(value) {
+ return typeof value === 'string' ||
+ !Array.isArray(value) && isObjectLike(value) && baseGetTag(value) === stringTag;
+}
+
+module.exports = {
+ isFunction: isFunction,
+ isString: isString,
+ isObjectLike: isObjectLike
+};
diff --git a/lib/plumbing.js b/lib/plumbing.js
index 979a0f2..4eceda4 100644
--- a/lib/plumbing.js
+++ b/lib/plumbing.js
@@ -1,10 +1,10 @@
'use strict';
var errors = require('./errors.js'),
- isFunction = require('lodash/isFunction'),
- isObjectLike = require('lodash/isObjectLike'),
- isString = require('lodash/isString'),
- isUndefined = require('lodash/isUndefined');
+ helpers = require('./helpers'),
+ isFunction = helpers.isFunction,
+ isObjectLike = helpers.isObjectLike,
+ isString = helpers.isString;
module.exports = function (options) {
@@ -19,7 +19,7 @@ module.exports = function (options) {
throw new TypeError(errorText + '.PromiseImpl');
}
- if (!isUndefined(options.constructorMixin) && !isFunction(options.constructorMixin)) {
+ if (options.constructorMixin !== undefined && !isFunction(options.constructorMixin)) {
throw new TypeError(errorText + '.PromiseImpl');
}
diff --git a/package.json b/package.json
index fc419a0..bb4ad24 100644
--- a/package.json
+++ b/package.json
@@ -32,9 +32,6 @@
"engines": {
"node": ">=0.10.0"
},
- "dependencies": {
- "lodash": "^4.17.15"
- },
"peerDependencies": {
"request": "^2.34"
},
@@ -50,6 +47,8 @@
"gulp-eslint": "~2.1.0",
"gulp-istanbul": "~1.0.0",
"gulp-mocha": "~2.2.0",
+ "lodash.flatten": "^4.4.0",
+ "lodash.isfunction": "^3.0.9",
"node-version": "~1.0.0",
"publish-please": "~2.4.1",
"request": "^2.34.0",
diff --git a/test/spec/plumbing.js b/test/spec/plumbing.js
index d6f9e7e..24c5f0a 100644
--- a/test/spec/plumbing.js
+++ b/test/spec/plumbing.js
@@ -1,6 +1,6 @@
'use strict';
-var _ = require('lodash'),
+var isFunction = require('lodash.isfunction'),
Bluebird = require('bluebird'),
errors = require('../../errors'),
plumbing = require('../../');
@@ -62,8 +62,8 @@ describe('Promise-Core\'s Plumbing', function () {
pl.init.call(context, {});
- expect(_.isFunction(context._rp_promise.then)).to.eql(true);
- expect(_.isFunction(context._rp_resolve)).to.eql(true);
+ expect(isFunction(context._rp_promise.then)).to.eql(true);
+ expect(isFunction(context._rp_resolve)).to.eql(true);
context._rp_resolve();
@@ -82,8 +82,8 @@ describe('Promise-Core\'s Plumbing', function () {
var context = {};
pl.init.call(context, {});
- expect(_.isFunction(context._rp_promise.then)).to.eql(true);
- expect(_.isFunction(context._rp_reject)).to.eql(true);
+ expect(isFunction(context._rp_promise.then)).to.eql(true);
+ expect(isFunction(context._rp_reject)).to.eql(true);
context._rp_reject(new Error('Rejected by test case'));
@@ -134,7 +134,7 @@ describe('Promise-Core\'s Plumbing', function () {
var context = {};
pl.init.call(context, {});
- expect(_.isFunction(context._rp_options.callback)).to.eql(true);
+ expect(isFunction(context._rp_options.callback)).to.eql(true);
delete context._rp_options.callback;
expect(context._rp_options).to.eql({