All updates and documentation on the Wiki. Please refer to the wiki for latest updated docs.
Release Notes
Feel free to open an Issue if you find anything wrong in the module! Or open a new Discussion if you have any suggestions, or just want to give a feedback!
npm i shwi-js
Shwi-js is an easy to use npm module that allows you to make your javascript code better! It makes many things easier, and has many new classes and functions that are usually very annoying to code!
const shwijs = require("shwi-js");
Just require the shwi js module, and get to coding!
Latest feature update: 1.1.3-beta.2
Please refer to the Docs(wiki) for proper documentation and updates
Main Class
Random integer and items
Err
Stack
Colors
Parser
Tank
Random Integer Generators
Kill Function
Countdown
Physics
Clock
const shwijs = require("shwi-js");
class MyClass extends shwijs.Main {
constructor() {
super("MyClass");
this.Log("Hello!");
}
}
const myClassInstance = new MyClass();
// Logs [Node/your_project_name/MyClass]: Hello to the console
To change the project name, you can do shwijs.Main.APP_NAME = "whatever you want"
!
(By default, it takes the project name from your package.json file)
You can also pass in multiple names for the class super()
function, if you're making class that is supposed to be part of another class:
const shwijs = require("shwi-js");
class MyClass extends shwijs.Main {
constructor(name) {
super("MyClass", name);
}
}
const myClassInstance = new MyClass();
class MyClassSubset extends MyClass {
constructor() {
super("SubsetA");
this.Log("Hello!");
}
}
const myClassSubsetInstance = new MyClassSubset();
// Logs [Node/app_name/MyClass/SubsetA]: Hello! to the console
You can also manually change the app_name
in the console logs using Main.SetAppName(name)
method!
NOTE: This is a static method.