0.0.1 • Published 2 years ago
@dmmdjs/dutils v0.0.1
Dutils
Table of Contents
About
Dutils implements various frequently used functions into one collection.
- Zero Dependencies
- Detailed JsDoc
- Easy to Use
- Near Optimized
Installation
Ensure you have the correct version of Node.js and npm installed:
Recommended:
- Node:
v16.4.0
- npm:
v7.18.1
Minimum:
- Node:
v14.17.1
- npm:
v7.18.1
Open a terminal with Node.js installed
npm i @dmmdjs/dutils@latest --save
Usage
Importing:
const dutils = require("@dmmdjs/dutils");
Basic Usage:
// Functions
console.log(dutils.typeOf("Hello world")); // "string"
console.log(dutils.classOf(new TypeError())); // TypeError
// Classes
let dcache = new DCache();
dcache.hello = "world";
console.log(dcache.get("hello")); // "world"
console.log("hello" in dcache); // true
dcache.ensure("hello", "everyone");
console.log(dcache.hello); // "world"
Full Examples:
let dcache = new DCache();
function store(username, id) {
if(dcache.has(username)) console.log("That username already exists! Aborting!");
else console.log(`Username: ${username} | ID: ${id}`);
dcache.ensure(username, id);
};
store("DmmD", "smort"); // "Username: DmmD | ID: smort"
store("Hello", "world"); // "Username: Hello | ID: world"
store("DmmD", "stoopid"); // "That username already exists! Aborting!"
console.log(dcache.DmmD); // "smort"
let clone = dcache.clone();
clone.DmmD = "stoopid";
console.log(dcache.DmmD, clone.DmmD); // "smort" "stoopid"
dcache.merge(clone, true);
console.log(dcache.DmmD); // "stoopid"
Alternative Options
Credits & Contact
Credits:
- iiPython
- Bug finding & supporting
Contact Information
- Discord Username:
DmmD - Dm123321_31mD Gaming#9423
- Discord Server (Fastest Approach): https://discord.gg/f3TdGwMMrt
- Email:
dm12332131mdgaming@gmail.com
- Github: https://github.com/dmmdjs
Notice
- README Format:
@dmmdjs README v3
- License:
MIT
Last Updated: Sep 24, 2021