# suouzuki

> This library was created specifically for personal use, but you can also use it! It only contains things that I, suouzuki, need in my projects (especially projects related to Discord).

Latest version **1.0.2** (published 2023-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install suouzuki
pnpm add suouzuki
yarn add suouzuki
bun add suouzuki
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-08-23 |
| First published | 2023-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 128.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | suouzuki |
| Maintainers | suouzuki |
| Keywords | discord, node-util, util, suouzuki, nino2221 |

## Links

- npm: https://www.npmjs.com/package/suouzuki
- npm.io page: https://npm.io/package/suouzuki

## Dependencies (6)

- [isurl](https://npm.io/package/isurl.md) ^4.0.2
- [colors](https://npm.io/package/colors.md) ^1.4.0
- [fuse.js](https://npm.io/package/fuse.js.md) ^6.6.2
- [discord.js](https://npm.io/package/discord.js.md) ^14.13.0
- [stack-trace](https://npm.io/package/stack-trace.md) ^1.0.0-pre2
- [numero-por-extenso](https://npm.io/package/numero-por-extenso.md) ^1.0.8

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-08-23
- 1.0.1 — 2023-08-23
- 1.0.0 — 2023-08-23

## README

# Suouzuki.

This library was created specifically for personal use, but you can also use it! It only contains things that I, suouzuki, need in my projects (especially projects related to Discord).

## Installation

To install it in your project is quite simple! Just use the code below

```bash
npm install suouzuki
```
<br> 
<br> 

## > Utility

This topic has numerous functions, but I will only cover the main ones.

Oh, and to have the functions below, use the example code provided below.
```javascript
const { util } = require("suouzuki");
util.isString("Hello World!"); // true
```

<br> 

### This is...

It checks if the value is indeed that, in the example above we used 'isString', which checks if it's a string, but there are various others such as:

*`isJSON(value)`* -> Check if the value is JSON or valid JSON.
```javascript
isJSON({ name: "John", age: 30, city: "New York" }); // true
isJSON('{"name":"John","age":30,"city":"New York"}'); // true

isJSON('{"name":"John","age":30,"city":"New York"'); // false (invalid JSON)
isJSON([]); // false
```
*`isEmpty(value)`* -> Check if the value is empty. (String, Array, Object, Map)
```javascript
isEmpty('  '); // true (empty string)
isEmpty([]); // true (empty array)
isEmpty(new Map()); // true (empty map)
isEmpty({}); // true (empty object)

isEmpty('Hello World!'); // false (non-empty string)
isEmpty([1, 2, 3]); // false (non-empty array)
isEmpty({ key: 'value' }); // false (non-empty object)
```
*`isPrimitive(value)`* -> Check if the value is a primitive (null, number, string, boolean, undefined, or symbol).
```javascript
isPrimitive(42); // true
isPrimitive("Hello World!"); // true
isPrimitive({}); // false
```
*`isBoolean(value)`** -> Check if the value is a Boolean.
```javascript
isBoolean(false); // true
isBoolean("false"); // false
```
*`isString(value)`* -> Check if the value is a String.
```javascript
isString("Hello World!"); // true
isString(42); // false
```

*`...`* -> And there are numerous functions like these that I can't mention all of.

<br> 

### String, Number, and Array

Useful functions for manipulating: String, Number, and Array. There are many more functions, but I'll only include two of each (my favorites for each).

#### - String
*`limit(string, limit, final)`* -> Limits the length of a string and adds a final character.
```javascript
const limitedString = limit("Olá, eu me chamo Suouzuki e programo Node.js!", 20, "...");
// Returns: "Olá, eu me chamo Suo..."
```
*`verify(string, ...search)`* -> Verifies the presence of specific substrings in a string.
```javascript
const searchResults = verify("Olá, quem é você?", "Olá", "você", "eu");
// Returns: [true, true, false]
```
*`...`*
#### - Number
*`toRoman(number)`* -> Convert a number to its Roman numeral representation.
```javascript
toRoman(42) // "XLII"
toRoman(1999) // "MCMXCIX"
```
*`abbrev(number)`* -> Convert a large number to an abbreviated format (e.g., 1000 to 1K, 1000000 to 1M).
```javascript
abbrev(1000) // "1K"
abbrev(1000000) // "1M"
```
*`...`*
#### - Array
*`get(array, search)`* -> Get an item from an array based on a search text using `Fuse.js`.
```javascript
const arr = ["Nino.", "José.", "Suouzuki."];
const value = get(arr, "josé"); // [{ name: "José.", ID: 1, score: 0.02 }]
```
*`random(array, path)`* -> Returns a random element from an array, based on a probability value.
```javascript
const arr = [
  { value: 'Suouzuki.', probability: 0.2 },
  { value: 'José.', probability: 0.3 },
  { value: 'Nino.', probability: 0.5 },
];

const randomElement = random(arr, 'probability'); // { value: 'Nino.', probability: 0.5 } or other
```
*`...`*

<br> 

### Error

It creates a custom error, allowing you to choose the name and description of the error.
```javascript
Error.custom("myError", "Oops! An unexpected error occurred.");
// myError: Oops! An unexpected error occurred.
```

<br> 

### Collection

Creates a collector similar to discord.js but changing certain things.

```javascript
const myCollection = new collection();
myCollection.set("value1", { test: true });
myCollection.set("value2", "hello");
```

<br>

### Color

Adds color to texts using the `'colors'` library.

```javascript
console.log(color("<color=red>Hello</>, are you <style=random>okay?</>"));
```

<br> 
<br> 

## > Discord

Utilities and functions for the discord.js library.

Oh, and to have the functions below, use the example code provided below.
```javascript
const { discord } = require("suouzuki");
```

### SlashCommandCreate

A class that dynamically creates slash commands (/).

```javascript
const CommandSlash = new slashCommandCreate("mycommand", "my first slash command");
CommandSlash.addOption("string", { length: { max: 10, min: 5 }, required: true });
```

---
_Source: https://npm.io/package/suouzuki · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
