1337.69.420 • Published 2 years ago
get-member v1337.69.420
Introduction
Tired of making a typo or a mistake when retrieving an object member and javascript silently
returning undefined, causing you to scratch your head over an error from an entirely different
place? Well cry no more, because get-member is here to save the day, with the least dependencies
of any npm package!
Usage
Install the package
$ npm install get-memberAnd require it
require("get-member")();
let myObj = {x: "hello!"};
console.log(myObj.getMember("x"));If the member variable was not found, an error will be thrown
let myObj = {x: "hello!"}
try {
console.log(myObj.getMember("y"));
} catch (err) {
console.log(err.message);
}Want to print a nice error into the console? We got you covered!
err.print();Don't want the program to continue because the error might be fatal? No problem!
err.panic();Want to report the error to your favorite discord server? Webhooks!
err.sendToWebhook("WEBHOOK URL");Want to run a lua script when the error happens? We got it all.
err.runLua(`print('Error: ${err.message}')`);Bugs
If you find any bugs, please, do not report them.
1337.69.420
2 years ago