Skip to content

Commit 2d71b6c

Browse files
committed
Reverted native functions to lodash as discussed in PR #54
1 parent 225f027 commit 2d71b6c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/rp.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
var Bluebird = require('./bluebird-fresh.js'),
44
CapturedTrace = require('./bluebird-captured-trace-fresh.js'),
55
assign = require('lodash/object/assign'),
6+
forEach = require('lodash/collection/forEach'),
67
isFunction = require('lodash/lang/isFunction'),
78
isPlainObject = require('lodash/lang/isPlainObject'),
89
isString = require('lodash/lang/isString'),
10+
isUndefined = require('lodash/lang/isUndefined'),
11+
keys = require('lodash/object/keys'),
912
chalk = require('chalk'),
1013
errors = require('./errors.js');
1114

@@ -14,7 +17,7 @@ var Bluebird = require('./bluebird-fresh.js'),
1417
var request = (function () {
1518

1619
function clearCache() {
17-
Object.keys(require.cache).forEach(function (key) {
20+
forEach(keys(require.cache), function (key) {
1821
delete require.cache[key];
1922
});
2023
}
@@ -131,7 +134,7 @@ function expose(methodToExpose, exposeAs) {
131134
exposeAs = exposeAs || methodToExpose;
132135

133136
/* istanbul ignore if */
134-
if (request.Request.prototype[exposeAs] !== undefined) {
137+
if (!isUndefined(request.Request.prototype[exposeAs])) {
135138
console.error(chalk.bold.bgRed('[Request-Promise] Unable to expose method "' + exposeAs + '". It is already implemented by Request. Please visit https://github.com/request/request-promise/wiki/Troubleshooting'));
136139
return;
137140
}

0 commit comments

Comments
 (0)