0.0.1 • Published 2 years ago

@dmmdjs/dutils v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

Notice

  • README Format: @dmmdjs README v3
  • License: MIT

Last Updated: Sep 24, 2021

0.0.1

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago