@zadytach/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +167 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1 +1,167 @@
1
- # BlackMagic-Core
1
+ # BlackMagic-Core
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/%40zadytach%2Fcore)](https://www.npmjs.com/package/@zadytach/core)
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC)
5
+
6
+ Uma coleção de funções utilitárias simples, leves e eficientes para tarefas comuns em projetos JavaScript/TypeScript.
7
+
8
+ ## 📦 Instalação
9
+
10
+ ```bash
11
+ npm install @zadytach/core
12
+ ```
13
+
14
+ ou com yarn:
15
+
16
+ ```bash
17
+ yarn add @zadytach/core
18
+ ```
19
+
20
+ ou com pnpm:
21
+
22
+ ```bash
23
+ pnpm add @zadytach/core
24
+ ```
25
+
26
+ ## 🚀 Uso Rápido
27
+
28
+ ```typescript
29
+ import {
30
+ isEmail,
31
+ isUrl,
32
+ isDefined,
33
+ equalsIgnoreCase,
34
+ sleep,
35
+ formatBytes,
36
+ msToTime,
37
+ } from "@zadytach/core";
38
+
39
+ // Validação
40
+ isEmail("test@example.com"); // true
41
+ isUrl("https://example.com"); // true
42
+ isDefined(null); // false
43
+
44
+ // String
45
+ equalsIgnoreCase("Hello", "hello"); // true
46
+
47
+ // Tempo
48
+ await sleep(1000); // aguarda 1 segundo
49
+ msToTime(3661000); // "01h 01m 01s"
50
+
51
+ // Formatação
52
+ formatBytes(1024); // "1 KB"
53
+ ```
54
+
55
+ ## 📚 Funções Disponíveis
56
+
57
+ ### ✅ Validação (`validation`)
58
+
59
+ - **`isEmail(email: string): boolean`** - Valida endereço de email
60
+ - **`isUrl(url: string): boolean`** - Valida URL
61
+ - **`isNumeric(text: string): boolean`** - Valida se é numérico
62
+ - **`isDefined(value: any): boolean`** - Verifica se valor está definido
63
+ - **`isPromise(value: any): boolean`** - Verifica se é uma Promise
64
+
65
+ ### 🔍 Verificação (`check`)
66
+
67
+ - **`equalsIgnoreCase(text1: string, text2: string): boolean`** - Compara strings ignorando maiúsculas
68
+ - **`includesIgnoreCase(text: string, query: string): boolean`** - Busca em string ignorando maiúsculas
69
+
70
+ ### ⏱️ Tempo (`timers` & `sleep`)
71
+
72
+ - **`sleep(ms: number): Promise<void>`** - Aguarda tempo especificado
73
+ - **`setIntervalAsync(callback, delay, immediate?): Promise<void>`** - Intervalo assíncrono
74
+ - **`setTimeoutAsync(callback, delay): Promise<void>`** - Timeout assíncrono
75
+
76
+ ### 🔄 Conversão (`convert` & `ms`)
77
+
78
+ - **`msToTime(ms: number): string`** - Converte milissegundos para formato legível (ex: "01h 30m 45s")
79
+ - **`timeToMs(time: string): number`** - Converte formato de tempo para milissegundos
80
+
81
+ ### 📅 Data (`date`)
82
+
83
+ - Funções para manipulação e formatação de datas
84
+
85
+ ### 🧮 Matemática (`math`)
86
+
87
+ - Funções utilitárias de matemática
88
+
89
+ ### 📏 Formatação (`format`)
90
+
91
+ - **`formatBytes(bytes: number): string`** - Formata bytes para unidade legível (KB, MB, GB, etc)
92
+ - Outras funções de formatação
93
+
94
+ ### 🛠️ Utilitários (`with`)
95
+
96
+ - Funções utilitárias gerais
97
+
98
+ ## 📂 Estrutura do Projeto
99
+
100
+ ```
101
+ src/
102
+ ├── index.ts
103
+ └── functions/
104
+ ├── check.ts # Verificações de string
105
+ ├── convert.ts # Funções de conversão
106
+ ├── date.ts # Manipulação de datas
107
+ ├── format.ts # Formatação de dados
108
+ ├── math.ts # Funções matemáticas
109
+ ├── ms.ts # Conversão de tempo
110
+ ├── sleep.ts # Delay assíncrono
111
+ ├── timers.ts # Timers assíncronos
112
+ ├── validation.ts # Validações
113
+ ├── with.ts # Utilitários gerais
114
+ └── index.ts # Exportações
115
+ ```
116
+
117
+ ## 🔧 Desenvolvimento
118
+
119
+ ### Build
120
+
121
+ ```bash
122
+ npm run build
123
+ ```
124
+
125
+ Compila TypeScript para JavaScript em `build/`.
126
+
127
+ ### Scripts Disponíveis
128
+
129
+ - `npm run build` - Compila o projeto
130
+
131
+ ## 📝 Exemplo Completo
132
+
133
+ ```typescript
134
+ import { isEmail, isDefined, sleep, formatBytes } from "@zadytach/core";
135
+
136
+ async function exampleFunction() {
137
+ // Validar email
138
+ if (isEmail("user@example.com")) {
139
+ console.log("Email válido!");
140
+ }
141
+
142
+ // Aguardar 2 segundos
143
+ await sleep(2000);
144
+ console.log("2 segundos se passaram");
145
+
146
+ // Formatar tamanho de arquivo
147
+ const fileSize = formatBytes(5242880);
148
+ console.log(`Tamanho: ${fileSize}`); // "Tamanho: 5 MB"
149
+ }
150
+
151
+ exampleFunction();
152
+ ```
153
+
154
+ ## 🤝 Contribuição
155
+
156
+ Contribuições são bem-vindas! Se encontrou um bug ou tem sugestões, abra uma [issue](https://github.com/HelzadyDev/BlackMagic-Core/issues).
157
+
158
+ ## 📄 Licença
159
+
160
+ Este projeto está licenciado sob a licença ISC - veja o arquivo [LICENSE](LICENSE) para detalhes.
161
+
162
+ ## 👨‍💻 Autor
163
+
164
+ **HelzadyDev**
165
+
166
+ - GitHub: [@HelzadyDev](https://github.com/HelzadyDev)
167
+ - npm: [@zadytach](https://www.npmjs.com/~zadytach)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zadytach/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Uma coleção de funções utilitárias simples e leves para tarefas comuns em projetos.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,4 +42,4 @@
42
42
  "./build/functions/index.js"
43
43
  ]
44
44
  }
45
- }
45
+ }