Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed dependency on lodash, removed pnpm-lock.yaml #591

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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