0.2.8 • Published 1 month ago

dollar-kit v0.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

$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
0.2.8

1 month ago

0.2.7

1 month ago

0.2.6

1 month ago

0.2.3

2 months ago

0.2.5

2 months ago

0.2.4

2 months ago

0.1.11

2 months ago

0.2.1

2 months ago

0.2.2

2 months ago

0.1.10

2 months ago

0.1.8

2 months ago

0.1.9

2 months ago

0.1.7

2 months ago

0.1.0

2 months ago

0.0.3

2 months ago

0.0.2

2 months ago

0.0.1

2 months ago