Skip to content

Commit

Permalink
removed dependency on lodash, removed pnpm-lock.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Hargrove committed Dec 15, 2023
1 parent cc9c009 commit 1062c51
Show file tree
Hide file tree
Showing 21 changed files with 86 additions and 2,281 deletions.
13 changes: 6 additions & 7 deletions lib/nodeJavaBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

process.env.PATH += require('../build/jvm_dll_path.json');

var _ = require('lodash');
var async = require('async');
var path = require('path');
var fs = require('fs');
Expand Down Expand Up @@ -152,15 +151,15 @@ java.ensureJvm = function(callback) {

// First see if the promise-style API should be used.
// This must be done first in order to ensure the proper API is used.
if (_.isUndefined(callback) && java.asyncOptions && _.isFunction(java.asyncOptions.promisify)) {
if (typeof callback === 'undefined' && java.asyncOptions && typeof java.asyncOptions.promisify === 'function') {
// Create a promisified version of this function.
var launchJvmPromise = java.asyncOptions.promisify(java.ensureJvm.bind(java));
// Call the promisified function, returning its result, which should be a promise.
return launchJvmPromise();
}

// If we get here, callback must be a node-style callback function. If not, throw an error.
else if (!_.isFunction(callback)) {
else if (typeof callback !== 'function') {
throw new Error('java.launchJvm(cb) requires its one argument to be a callback function.');
}

Expand Down Expand Up @@ -196,7 +195,7 @@ java.onJvmCreated = function() {
throw new Error('In asyncOptions, if either promiseSuffix or promisify is defined, both most be.');
}

if (_.isString(java.asyncOptions.ifReadOnlySuffix) && java.asyncOptions.ifReadOnlySuffix !== '') {
if (typeof java.asyncOptions.ifReadOnlySuffix === 'string' && java.asyncOptions.ifReadOnlySuffix !== '') {
ifReadOnlySuffix = java.asyncOptions.ifReadOnlySuffix;
}
} else {
Expand Down Expand Up @@ -272,17 +271,17 @@ java.import = function(name) {
&& ((modifiers & MODIFIER_STATIC) === MODIFIER_STATIC)) {
var methodName = SyncCall(methods[i], 'getName')();

if (_.isString(syncSuffix)) {
if (typeof syncSuffix === 'string') {
var syncName = usableName(methodName + syncSuffix);
result[syncName] = callStaticMethodSync.bind(java, name, methodName);
}

if (_.isString(asyncSuffix)) {
if (typeof asyncSuffix === 'string') {
var asyncName = usableName(methodName + asyncSuffix);
result[asyncName] = callStaticMethod.bind(java, name, methodName);
}

if (promisify && _.isString(promiseSuffix)) {
if (promisify && typeof promiseSuffix === 'string') {
var promiseName = usableName(methodName + promiseSuffix);
result[promiseName] = promisify(callStaticMethod.bind(java, name, methodName));
}
Expand Down
10 changes: 2 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"async": "^3.2.5",
"find-java-home": "^2.0.0",
"glob": "^10.3.10",
"lodash": "^4.17.21",
"nan": "^2.18.0",
"node-gyp": "^10.0.1"
},
Expand Down
Loading

0 comments on commit 1062c51

Please sign in to comment.