Skip to content

Latest commit

 

History

History
202 lines (138 loc) · 2.4 KB

README.md

File metadata and controls

202 lines (138 loc) · 2.4 KB

$filter(array, searchText, key)

let items = ["laptop", "to year", "pen"];

console.log($filter(items, "to"));
// [ "laptop", "to year" ]
let items = [
  { name: "laptop", key: "property" },
  { name: "to year", key: "property" },
  { name: "pen", key: "property" },
];

console.log($filter(items, "to", "name"));
// [{ name: "laptop" }, { name: "to year" }]

$abc()

console.log($abc());
// [a, .., z]

$number(from, to)

console.log($number(-3, 5));
// [-3, -2, -1, 0, 1, 2, 3, 4, 5]

$getId(length)

console.log($getId(6));
// RlqQta

$percentage(number, mainNumber)

console.log($percentage(2, 4));
// 50

$capitalize(text)

console.log($capitalize("hello world"));
// Hello world

$randomInt(minNumber, maxNumber)

console.log($randomInt(5, 10));
// random number: 7

$total(array, number)

let array = [4, 3];

console.log($total(array));
// 7
let array = [{ count: 4 }, { count: 3 }];

console.log($total(array, "count"));
// 7

$formatNumber(number)

console.log($formatNumber(4000000));
// 4 000 000

$shuffleArray(array)

let array = ["first", "second", "third"];

console.log($shuffleArray(array));
// [ "third", "first", "second" ]

$truncateString(text, length)

console.log($truncateString("Hello world", 3));
// Hel...

$is

console.log($is.odd(3));
// true
console.log($is.even(3));
// false
console.log($is.null(null));
// true
console.log($is.undefined(undefined));
// true

$uniqueArray(array)

let array = [1, 2, 3, 3, 4, 5, 5, 5];

console.log($uniqueArray(array));
// [1, 2, 3, 4, 5]

$reverseText()

console.log($reverseText("Hello"));
// olleH

$padStart(text, length, char)

console.log($padStart("Hello", 10, "-"));
// --Hello

$padEnd(text, length, char)

console.log($padEnd("Hello", 10, "*"));
// Hello*****

$randomItem(array)

let array = [1, 2, 3, 4, 5, 6];

console.log($randomItem(array));
// 3

$formatDate(date)

console.log($formatDate("2008-04-30"));
// Wed Apr 30 2008