1.3.0 • Published 4 years ago

dmmd.js v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

DmmD.js

About

DmmD.js is an npm package created by DmmD for maximum precision and better functionalities

Features:

  • Zero Dependencies
  • Detailed JsDoc
  • Near Optimized

Installation

npm install dmmd.js@latest --save

Requirements

Recommended:

  • Node: v16.4.0
  • npm: v7.18.1

Minimum (Not Yet Tested):

  • Node: v14.17.1
  • npm: v7.18.1

Table of Contents

DMath

About

DMath allows maximum precisions in calculating number-like values

* Note: Results returned from DMath are always strings

Basic Usage

// Imports
const { dmath } = require("dmmd.js");

// Basics
console.log(dmath.add(5, "10")); // "15"
console.log(dmath.minus(5, "10")); // "-5"

// Extras
console.log(dmath.abs(-5)); // "5"
console.log(dmath.neg("5")); // "-5"

Full Examples

// Imports
const { dmath } = require("dmmd.js");

// Example #1
function addFive(number) {
    return parseFloat(dmath.add(number, 5));
};

console.log(addFive(6)); // 11

// Example #2
let userBalance = 222.2;

function payCheck(amount) {
    console.log(userBalance + amount); // 324.79999999999995
    console.log(dmath.add(userBalance, amount)); // "324.8"
    userBalance = dmath.add(userBalance, amount);
};

payCheck(102.6);

// Example #3
console.log(1 / 123456); // 0.000008100051840331778
console.log(dmath.divide(1, 123456)); // "0.0000081000518403"
console.log(dmath.divide(1, 123456, 10000)); // "0.0000081000...4375324002"

Alternative Options

DPaint

About

DPaint enables a wide range of colors and styles to use in your terminal

* Learn more about how this works here!

Basic Usage

// Imports
const { dpaint } = require("dmmd.js");

// Colors
console.log(dpaint.red("Hello world")); // "Hello world" in red
console.log(dpaint.green("Hello everyone", true)); // "Hello everyone" with green background
console.log(dpaint.rgb("Blue", 0, 0, 255)); // "Blue" in blue
console.log(dpaint.hex("White", "#FFFFFF", true)); // "White" with white background

// Styles
console.log(dpaint.bold("Boldness")); // "Boldness" in bold
console.log(dpaint.italic("Italic")); // "Italic" in italic

// Extras
console.log(dpaint.rgb("VSC Red", ...dpaint.preset("vsc", "red"))); // "VSC Red" in red with visual studio code display
console.log(dpaint.orange("Oranges and Apples")); // "Oranges and Apples" in orange
console.log(dpaint.trueRed("Actual RED")); // "Actual RED" in red

Full Examples

// Imports
const { dpaint } = require("dmmd.js");

// Example #1
function redGradient() {
    let string = "";
    for(let i = 0; i < 255; i++) string += dpaint.rgb(" ", i, 0, 0, true);
    return string;
};

console.log(redGradient()); // Prints out a red gradient

// Example #2
function log(time, user, message) {
    return `(${dpaint.red(time)}) | ${dpaint.yellow(user)}: ${dpaint.green(message)}`;
};

console.log(log("15:13", "System", "Hello world")); // "(15:13) | System: Hello world"

Alternative Options

DUtils

About

DUtils adds common Node.js functions to facilitate the process

Basic Usage

// Imports
const { dutils } = require("dmmd.js");

// Functions
console.log(dutils.typeOf("Hello world")); // "string"
console.log(dutils.classOf(new TypeError())); // TypeError

// Classes
let dinterval = new dutils.Interval(1000);
dinterval.on("iterate", () => {
    console.log("Hello world"); // "Hello world"
});

let dobject = new dutils.DObject();
dobject.hello = "world";
console.log(dobject.hello); // "world"
console.log(dobject["hello"]); // "world"
console.log(dobject.get("hello")); // "world"
console.log("hello" in dobject); // true

Full Examples

// Imports
const { dutils } = require("dmmd.js");

// Example #1
let dinterval = new dutils.DInterval(1000);
dinterval.on("iterate", () => {
    console.clear();
    let now = new Date();
    let time = [ now.getHours() % 12 ?? 12, now.getMinutes(), now.getSeconds() ];
    console.log(`Current time: ${time.map(t => t.toString().padStart(2, "0")).join(":")}`);
});

// Example #2
let dobject = new dutils.DObject();
dobject.set(2, "Favorite number");
dobject.set("2", "Favorite number in string");
console.log(dobject[2]); // "Favorite number in string"
console.log(dobject.get(2)); // "Favorite number"

Credits & Special Thanks

iiPython

  • Bug finding & supporting

Contact Information

1.3.0

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago