|
2 | 2 |
|
3 | 3 | process.env.PATH += require('../build/jvm_dll_path.json');
|
4 | 4 |
|
5 |
| -var _ = require('lodash'); |
6 | 5 | var async = require('async');
|
7 | 6 | var path = require('path');
|
8 | 7 | var fs = require('fs');
|
@@ -152,15 +151,15 @@ java.ensureJvm = function(callback) {
|
152 | 151 |
|
153 | 152 | // First see if the promise-style API should be used.
|
154 | 153 | // This must be done first in order to ensure the proper API is used.
|
155 |
| - if (_.isUndefined(callback) && java.asyncOptions && _.isFunction(java.asyncOptions.promisify)) { |
| 154 | + if (typeof callback === 'undefined' && java.asyncOptions && typeof java.asyncOptions.promisify === 'function') { |
156 | 155 | // Create a promisified version of this function.
|
157 | 156 | var launchJvmPromise = java.asyncOptions.promisify(java.ensureJvm.bind(java));
|
158 | 157 | // Call the promisified function, returning its result, which should be a promise.
|
159 | 158 | return launchJvmPromise();
|
160 | 159 | }
|
161 | 160 |
|
162 | 161 | // If we get here, callback must be a node-style callback function. If not, throw an error.
|
163 |
| - else if (!_.isFunction(callback)) { |
| 162 | + else if (typeof callback !== 'function') { |
164 | 163 | throw new Error('java.launchJvm(cb) requires its one argument to be a callback function.');
|
165 | 164 | }
|
166 | 165 |
|
@@ -196,7 +195,7 @@ java.onJvmCreated = function() {
|
196 | 195 | throw new Error('In asyncOptions, if either promiseSuffix or promisify is defined, both most be.');
|
197 | 196 | }
|
198 | 197 |
|
199 |
| - if (_.isString(java.asyncOptions.ifReadOnlySuffix) && java.asyncOptions.ifReadOnlySuffix !== '') { |
| 198 | + if (typeof java.asyncOptions.ifReadOnlySuffix === 'string' && java.asyncOptions.ifReadOnlySuffix !== '') { |
200 | 199 | ifReadOnlySuffix = java.asyncOptions.ifReadOnlySuffix;
|
201 | 200 | }
|
202 | 201 | } else {
|
@@ -272,17 +271,17 @@ java.import = function(name) {
|
272 | 271 | && ((modifiers & MODIFIER_STATIC) === MODIFIER_STATIC)) {
|
273 | 272 | var methodName = SyncCall(methods[i], 'getName')();
|
274 | 273 |
|
275 |
| - if (_.isString(syncSuffix)) { |
| 274 | + if (typeof syncSuffix === 'string') { |
276 | 275 | var syncName = usableName(methodName + syncSuffix);
|
277 | 276 | result[syncName] = callStaticMethodSync.bind(java, name, methodName);
|
278 | 277 | }
|
279 | 278 |
|
280 |
| - if (_.isString(asyncSuffix)) { |
| 279 | + if (typeof asyncSuffix === 'string') { |
281 | 280 | var asyncName = usableName(methodName + asyncSuffix);
|
282 | 281 | result[asyncName] = callStaticMethod.bind(java, name, methodName);
|
283 | 282 | }
|
284 | 283 |
|
285 |
| - if (promisify && _.isString(promiseSuffix)) { |
| 284 | + if (promisify && typeof promiseSuffix === 'string') { |
286 | 285 | var promiseName = usableName(methodName + promiseSuffix);
|
287 | 286 | result[promiseName] = promisify(callStaticMethod.bind(java, name, methodName));
|
288 | 287 | }
|
|
0 commit comments