@justthedev123/builderutils
Version:
Basic utilities for developers
102 lines (70 loc) • 1.68 kB
Markdown
# @justthedev/builderutils
A lightweight and powerful collection of JavaScript utility functions. No dependencies. Built for speed, simplicity, and developer happiness 😄
## Installation
```bash
npm install @justthedev/builderutils
```
## Functions
### `isWeekend(date?)`
Checks if a given date falls on the weekend.
```js
isWeekend(); // true or false
```
### `randomEmoji()`
Returns a random emoji.
```js
randomEmoji(); // "🎉"
```
### `durationHumanizer(ms)`
Converts milliseconds into `"1h 23m 45s"` format.
```js
durationHumanizer(5023000); // "1h 23m 43s"
```
### `formatTimeMs(ms)`
Converts milliseconds into `"hh:mm:ss"` format.
```js
formatTimeMs(5023000); // "01:23:43"
```
### `portChecker(port, host?)`
Checks if a port is available (default: localhost).
```js
await portChecker(3000); // true or false
```
### `yesNoPrompt(question?)`
Simple CLI yes/no prompt.
```js
const answer = await yesNoPrompt("Continue?");
console.log(answer ? "Yes" : "No");
```
### `simpleProgress(current, total, width?)`
Displays a basic CLI progress bar.
```js
simpleProgress(50, 100); // [█████-----] 50%
```
### `fakeUser()`
Generates a random fake user with name, email, username, password, phone number, and address.
```js
fakeUser();
/*
{
name: 'Emma Bakker',
email: 'emma.bakker@mail.com',
username: 'Emma732',
password: 'k7s93jf9kd',
phone: '06-12345678',
address: 'Dorpsstraat 82, Rotterdam'
}
*/
```
## Author
Made with ❤️ by [JustTheDev](https://justthedev.42web.io)
## License
MIT