erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.64k stars 269 forks source link

Logical Error in `VerifyHuman` Constructor #232

Open JKamsker opened 9 months ago

JKamsker commented 9 months ago

Describe the bug

Hello,

I've found a potential issue in the VerifyHuman class, specifically in its constructor. Currently, the constructor throws an error if the HuggingFaceToken is an empty string or if it exists. Here's the relevant code:

if (HuggingFaceToken === "" || HuggingFaceToken) {
  throw new Error("HuggingFaceToken is required");
}

However, I believe the intended behavior is to throw an error if HuggingFaceToken is an empty string or if it does not exist. The corrected code would look like this:

if (HuggingFaceToken === "" || !HuggingFaceToken) {
  throw new Error("HuggingFaceToken is required");
}

This change will ensure that an error is thrown when HuggingFaceToken is either an empty string or undefined, which seems to be the intended behavior.

Please let me know if you need any further information or clarification.

Best regards.