stubby.ts
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

CodeQL Repo Dependents npm version NPM Download

stubby.ts

It's powerful and full laziness module for JavaScript and TypeScript.

Docs

RandomNumber(min, max)
import { RandomNumber } from "stubby.ts";

let rand = RandomNumber(10, 100);
console.log(rand); // now it will take random numbers between 10 to 100 
RandomArray(object)
import { RandomArray } from "stubby.ts";


// first example.
let fruits = [
  "Apple",
  "Pineapple",
  "Orange",
  "Strawberry",
  "Mango",
  "Cherry"
];

let randomFruits = RandomArray(fruits);
console.log(randomFruits); // it will send the array value randmly 


// second example
let names = [
  {
    name: "Arif"
  },
  {
    name: "Afrin"
  }
];

let randomNames = RandomArray(names);
console.log(randomNames.name); // it will send the array json object value randomly
SmallNumber(count, digits)
import { SmallNumber } from "stubby.ts";

let num = "143";
let digits = num.length + 1;

console.log(SmallNumber(num, digits)) // it wil print superscript numbers like ⁰¹²³⁴⁵⁶⁷⁸⁹
SystemInfo()
import { SystemInfo } from "stubby.ts";

console.log(SystemInfo().memory());
console.log(SystemInfo().memoryUsage());
console.log(SystemInfo().cpuUsage());
console.log(SystemInfo().cores());
console.log(SystemInfo().cpuBrand());
console.log(SystemInfo().uptime());
Replace(string, replacements)
import { Replace } from 'stubby.ts';

const paragraph = `
  %boyname% loves %girlname%, but %girlname% doesn't know yet.
`;

const replacements = {
  '%boyname%': 'Arif',
  '%girlname%': 'Afrin'
};

const loveStory = Replace(paragraph, replacements);

console.log(loveStory);

Thanks

Have a great day!😊

Package Sidebar

Install

npm i stubby.ts

Weekly Downloads

3

Version

1.3.2

License

MIT

Unpacked Size

13.2 kB

Total Files

14

Last publish

Collaborators

  • notrealarif