@react-hive/honey-utils 1.2.0 โ†’ 1.3.0

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.
package/README.md CHANGED
@@ -0,0 +1,292 @@
1
+ # @react-hive/honey-utils
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@react-hive/honey-utils.svg)](https://www.npmjs.com/package/@react-hive/honey-utils)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A lightweight TypeScript utility library providing a collection of helper functions for common programming tasks.
7
+
8
+ ## Features
9
+
10
+ - ๐Ÿ” **Type Guards** - Functions for runtime type checking
11
+ - ๐Ÿงต **String Utilities** - String manipulation and transformation
12
+ - ๐Ÿ”ข **Array Utilities** - Array filtering and manipulation
13
+ - ๐Ÿงฎ **Math Utilities** - Common mathematical calculations
14
+ - ๐ŸŽฏ **Function Utilities** - Function handling helpers
15
+ - ๐Ÿ–ฅ๏ธ **DOM Utilities** - Browser DOM manipulation helpers
16
+ - ๐Ÿ“ฆ **Zero Dependencies** - Lightweight and dependency-free
17
+ - ๐Ÿ“ **TypeScript Support** - Full TypeScript type definitions
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ # Using npm
23
+ npm install @react-hive/honey-utils
24
+
25
+ # Using yarn
26
+ yarn add @react-hive/honey-utils
27
+
28
+ # Using pnpm
29
+ pnpm add @react-hive/honey-utils
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ### Importing
35
+
36
+ ```typescript
37
+ // Import specific utilities
38
+ import { toKebabCase, isString, boolFilter } from '@react-hive/honey-utils';
39
+
40
+ // Or import everything
41
+ import * as HoneyUtils from '@react-hive/honey-utils';
42
+ ```
43
+
44
+ ### String Utilities
45
+
46
+ ```typescript
47
+ import { toKebabCase, camelToDashCase, splitStringIntoWords, hashString } from '@react-hive/honey-utils';
48
+
49
+ // Convert string to kebab-case
50
+ toKebabCase('helloWorld'); // 'hello-world'
51
+
52
+ // Convert camelCase to dash-case
53
+ camelToDashCase('helloWorld'); // 'hello-world'
54
+
55
+ // Split string into words
56
+ splitStringIntoWords('hello world'); // ['hello', 'world']
57
+
58
+ // Generate a hash from a string
59
+ const hash = hashString('background-color: red;'); // 'e4k1z0x'
60
+ ```
61
+
62
+ ### Array Utilities
63
+
64
+ ```typescript
65
+ import { boolFilter } from '@react-hive/honey-utils';
66
+
67
+ // Filter out falsy values from an array
68
+ const array = [0, 1, false, 2, '', 3, null, undefined, true];
69
+ boolFilter(array); // [1, 2, 3, true]
70
+ ```
71
+
72
+ ### Function Utilities
73
+
74
+ ```typescript
75
+ import { noop, invokeIfFunction } from '@react-hive/honey-utils';
76
+
77
+ // No-operation function
78
+ noop(); // does nothing
79
+
80
+ // Invoke if function, otherwise return value
81
+ const fn = (x: number) => x * 2;
82
+
83
+ invokeIfFunction(fn, 5); // 10
84
+ invokeIfFunction('not a function', 5); // 'not a function'
85
+ ```
86
+
87
+ ### Type Guards
88
+
89
+ ```typescript
90
+ import {
91
+ isString,
92
+ isNumber,
93
+ isBool,
94
+ isObject,
95
+ isFunction,
96
+ isPromise,
97
+ isNil,
98
+ isNilOrEmptyString,
99
+ isArray,
100
+ isEmptyArray,
101
+ isEmptyObject,
102
+ isNull,
103
+ isUndefined,
104
+ isDate,
105
+ isValidDate,
106
+ isRegExp,
107
+ isMap,
108
+ isSet
109
+ } from '@react-hive/honey-utils';
110
+
111
+ // Check if value is a string
112
+ isString('hello'); // true
113
+ isString(123); // false
114
+
115
+ // Check if value is a number
116
+ isNumber(123); // true
117
+ isNumber('123'); // false
118
+
119
+ // Check if value is a boolean
120
+ isBool(true); // true
121
+ isBool('true'); // false
122
+
123
+ // Check if value is an object
124
+ isObject({}); // true
125
+ isObject('object'); // false
126
+
127
+ // Check if value is a function
128
+ isFunction(() => {}); // true
129
+ isFunction({}); // false
130
+
131
+ // Check if value is a Promise
132
+ isPromise(Promise.resolve()); // true
133
+ isPromise({}); // false
134
+
135
+ // Check if value is null or undefined
136
+ isNil(null); // true
137
+ isNil(undefined); // true
138
+ isNil(''); // false
139
+
140
+ // Check if value is null, undefined, or empty string
141
+ isNilOrEmptyString(''); // true
142
+ isNilOrEmptyString(null); // true
143
+ isNilOrEmptyString('hello'); // false
144
+
145
+ // Check if value is an array
146
+ isArray([1, 2, 3]); // true
147
+ isArray({}); // false
148
+
149
+ // Check if value is an empty array
150
+ isEmptyArray([]); // true
151
+ isEmptyArray([1, 2, 3]); // false
152
+
153
+ // Check if value is an empty object
154
+ isEmptyObject({}); // true
155
+ isEmptyObject({ key: 'value' }); // false
156
+
157
+ // Check if value is a Date object
158
+ isDate(new Date()); // true
159
+ isDate('2023-01-01'); // false
160
+
161
+ // Check if value is a valid Date object
162
+ isValidDate(new Date()); // true
163
+ isValidDate(new Date('invalid')); // false
164
+
165
+ // Check if value is a RegExp
166
+ isRegExp(/test/); // true
167
+ isRegExp('test'); // false
168
+
169
+ // Check if value is a Map or Set
170
+ isMap(new Map()); // true
171
+ isSet(new Set()); // true
172
+ ```
173
+
174
+ ### Math Utilities
175
+
176
+ ```typescript
177
+ import {
178
+ calculateEuclideanDistance,
179
+ calculateMovingSpeed,
180
+ calculatePercentage
181
+ } from '@react-hive/honey-utils';
182
+
183
+ // Calculate Euclidean distance between two points
184
+ calculateEuclideanDistance(0, 0, 3, 4); // 5
185
+
186
+ // Calculate moving speed
187
+ calculateMovingSpeed(100, 5); // 20
188
+
189
+ // Calculate percentage of a value
190
+ calculatePercentage(200, 25); // 50
191
+ ```
192
+
193
+ ### DOM Utilities
194
+
195
+ ```typescript
196
+ import { getTransformationValues } from '@react-hive/honey-utils';
197
+
198
+ // Get transformation values from an HTML element
199
+ const element = document.getElementById('my-element');
200
+ if (element) {
201
+ const { translateX, translateY } = getTransformationValues(element);
202
+
203
+ console.log(`Element is translated by ${translateX}px horizontally and ${translateY}px vertically`);
204
+ }
205
+ ```
206
+
207
+ ### Assert Function
208
+
209
+ ```typescript
210
+ import { assert } from '@react-hive/honey-utils';
211
+
212
+ // Assert a condition
213
+ function divide(a: number, b: number): number {
214
+ assert(b !== 0, 'Cannot divide by zero');
215
+ return a / b;
216
+ }
217
+ ```
218
+
219
+ ## API Documentation
220
+
221
+ ### String Utilities
222
+
223
+ - **toKebabCase(input: string): string** - Converts a string to kebab-case
224
+ - **camelToDashCase(input: string): string** - Converts camelCase to dash-case
225
+ - **splitStringIntoWords(input: string): string[]** - Splits a string into an array of words
226
+ - **hashString(input: string): string** - Generates a short hash from a string
227
+
228
+ ### Array Utilities
229
+
230
+ - **boolFilter<T>(array: (T | false | null | undefined)[]): T[]** - Filters out falsy values from an array
231
+
232
+ ### Function Utilities
233
+
234
+ - **noop(): void** - A no-operation function
235
+ - **invokeIfFunction<Args extends any[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args): Result** - Invokes the input if it's a function, otherwise returns it as-is
236
+
237
+ ### Type Guards
238
+
239
+ - **isString(value: unknown): value is string** - Checks if a value is a string
240
+ - **isNumber(value: unknown): value is number** - Checks if a value is a number
241
+ - **isBool(value: unknown): value is boolean** - Checks if a value is a boolean
242
+ - **isObject(value: unknown): value is object** - Checks if a value is an object
243
+ - **isFunction(value: unknown): value is Function** - Checks if a value is a function
244
+ - **isPromise<T = unknown>(value: unknown): value is Promise<T>** - Checks if a value is a Promise
245
+ - **isNil(value: unknown): value is null | undefined** - Checks if a value is null or undefined
246
+ - **isNilOrEmptyString(value: unknown): value is null | undefined** - Checks if a value is null, undefined, or an empty string
247
+ - **isArray(value: unknown): value is unknown[]** - Checks if a value is an array
248
+ - **isEmptyArray(value: unknown): value is []** - Checks if a value is an empty array
249
+ - **isEmptyObject(value: unknown): value is Record<string, never>** - Checks if a value is an empty object
250
+ - **isNull(value: unknown): value is null** - Checks if a value is null
251
+ - **isUndefined(value: unknown): value is undefined** - Checks if a value is undefined
252
+ - **isFiniteNumber(value: unknown): value is number** - Checks if a value is a finite number
253
+ - **isInteger(value: unknown): value is number** - Checks if a value is an integer
254
+ - **isNaN(value: unknown): boolean** - Checks if a value is NaN
255
+ - **isDate(value: unknown): value is Date** - Checks if a value is a Date object
256
+ - **isValidDate(value: unknown): value is Date** - Checks if a value is a valid Date object (not Invalid Date)
257
+ - **isRegExp(value: unknown): value is RegExp** - Checks if a value is a RegExp object
258
+ - **isMap(value: unknown): value is Map<unknown, unknown>** - Checks if a value is a Map
259
+ - **isSet(value: unknown): value is Set<unknown>** - Checks if a value is a Set
260
+ - **isSymbol(value: unknown): value is symbol** - Checks if a value is a Symbol
261
+
262
+ ### Math Utilities
263
+
264
+ - **calculateEuclideanDistance(startX: number, startY: number, endX: number, endY: number): number** - Calculates the Euclidean distance between two points
265
+ - **calculateMovingSpeed(delta: number, elapsedTime: number): number** - Calculates moving speed
266
+ - **calculatePercentage(value: number, percentage: number): number** - Calculates the specified percentage of a value
267
+
268
+ ### DOM Utilities
269
+
270
+ - **getTransformationValues(element: HTMLElement): { translateX: number, translateY: number }** - Gets transformation values from an HTML element
271
+
272
+ ### Other Utilities
273
+
274
+ - **assert(condition: any, message: string): asserts condition** - Asserts that a condition is truthy, throwing an error with the provided message if it's not
275
+
276
+ ## Contributing
277
+
278
+ Contributions are welcome! Please feel free to submit a Pull Request.
279
+
280
+ 1. Fork the repository
281
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
282
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
283
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
284
+ 5. Open a Pull Request
285
+
286
+ ## License
287
+
288
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
289
+
290
+ ## Author
291
+
292
+ Mykhailo Aliinyk <m.aliynik@gmail.com>
package/dist/README.md CHANGED
@@ -0,0 +1,292 @@
1
+ # @react-hive/honey-utils
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@react-hive/honey-utils.svg)](https://www.npmjs.com/package/@react-hive/honey-utils)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A lightweight TypeScript utility library providing a collection of helper functions for common programming tasks.
7
+
8
+ ## Features
9
+
10
+ - ๐Ÿ” **Type Guards** - Functions for runtime type checking
11
+ - ๐Ÿงต **String Utilities** - String manipulation and transformation
12
+ - ๐Ÿ”ข **Array Utilities** - Array filtering and manipulation
13
+ - ๐Ÿงฎ **Math Utilities** - Common mathematical calculations
14
+ - ๐ŸŽฏ **Function Utilities** - Function handling helpers
15
+ - ๐Ÿ–ฅ๏ธ **DOM Utilities** - Browser DOM manipulation helpers
16
+ - ๐Ÿ“ฆ **Zero Dependencies** - Lightweight and dependency-free
17
+ - ๐Ÿ“ **TypeScript Support** - Full TypeScript type definitions
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ # Using npm
23
+ npm install @react-hive/honey-utils
24
+
25
+ # Using yarn
26
+ yarn add @react-hive/honey-utils
27
+
28
+ # Using pnpm
29
+ pnpm add @react-hive/honey-utils
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ### Importing
35
+
36
+ ```typescript
37
+ // Import specific utilities
38
+ import { toKebabCase, isString, boolFilter } from '@react-hive/honey-utils';
39
+
40
+ // Or import everything
41
+ import * as HoneyUtils from '@react-hive/honey-utils';
42
+ ```
43
+
44
+ ### String Utilities
45
+
46
+ ```typescript
47
+ import { toKebabCase, camelToDashCase, splitStringIntoWords, hashString } from '@react-hive/honey-utils';
48
+
49
+ // Convert string to kebab-case
50
+ toKebabCase('helloWorld'); // 'hello-world'
51
+
52
+ // Convert camelCase to dash-case
53
+ camelToDashCase('helloWorld'); // 'hello-world'
54
+
55
+ // Split string into words
56
+ splitStringIntoWords('hello world'); // ['hello', 'world']
57
+
58
+ // Generate a hash from a string
59
+ const hash = hashString('background-color: red;'); // 'e4k1z0x'
60
+ ```
61
+
62
+ ### Array Utilities
63
+
64
+ ```typescript
65
+ import { boolFilter } from '@react-hive/honey-utils';
66
+
67
+ // Filter out falsy values from an array
68
+ const array = [0, 1, false, 2, '', 3, null, undefined, true];
69
+ boolFilter(array); // [1, 2, 3, true]
70
+ ```
71
+
72
+ ### Function Utilities
73
+
74
+ ```typescript
75
+ import { noop, invokeIfFunction } from '@react-hive/honey-utils';
76
+
77
+ // No-operation function
78
+ noop(); // does nothing
79
+
80
+ // Invoke if function, otherwise return value
81
+ const fn = (x: number) => x * 2;
82
+
83
+ invokeIfFunction(fn, 5); // 10
84
+ invokeIfFunction('not a function', 5); // 'not a function'
85
+ ```
86
+
87
+ ### Type Guards
88
+
89
+ ```typescript
90
+ import {
91
+ isString,
92
+ isNumber,
93
+ isBool,
94
+ isObject,
95
+ isFunction,
96
+ isPromise,
97
+ isNil,
98
+ isNilOrEmptyString,
99
+ isArray,
100
+ isEmptyArray,
101
+ isEmptyObject,
102
+ isNull,
103
+ isUndefined,
104
+ isDate,
105
+ isValidDate,
106
+ isRegExp,
107
+ isMap,
108
+ isSet
109
+ } from '@react-hive/honey-utils';
110
+
111
+ // Check if value is a string
112
+ isString('hello'); // true
113
+ isString(123); // false
114
+
115
+ // Check if value is a number
116
+ isNumber(123); // true
117
+ isNumber('123'); // false
118
+
119
+ // Check if value is a boolean
120
+ isBool(true); // true
121
+ isBool('true'); // false
122
+
123
+ // Check if value is an object
124
+ isObject({}); // true
125
+ isObject('object'); // false
126
+
127
+ // Check if value is a function
128
+ isFunction(() => {}); // true
129
+ isFunction({}); // false
130
+
131
+ // Check if value is a Promise
132
+ isPromise(Promise.resolve()); // true
133
+ isPromise({}); // false
134
+
135
+ // Check if value is null or undefined
136
+ isNil(null); // true
137
+ isNil(undefined); // true
138
+ isNil(''); // false
139
+
140
+ // Check if value is null, undefined, or empty string
141
+ isNilOrEmptyString(''); // true
142
+ isNilOrEmptyString(null); // true
143
+ isNilOrEmptyString('hello'); // false
144
+
145
+ // Check if value is an array
146
+ isArray([1, 2, 3]); // true
147
+ isArray({}); // false
148
+
149
+ // Check if value is an empty array
150
+ isEmptyArray([]); // true
151
+ isEmptyArray([1, 2, 3]); // false
152
+
153
+ // Check if value is an empty object
154
+ isEmptyObject({}); // true
155
+ isEmptyObject({ key: 'value' }); // false
156
+
157
+ // Check if value is a Date object
158
+ isDate(new Date()); // true
159
+ isDate('2023-01-01'); // false
160
+
161
+ // Check if value is a valid Date object
162
+ isValidDate(new Date()); // true
163
+ isValidDate(new Date('invalid')); // false
164
+
165
+ // Check if value is a RegExp
166
+ isRegExp(/test/); // true
167
+ isRegExp('test'); // false
168
+
169
+ // Check if value is a Map or Set
170
+ isMap(new Map()); // true
171
+ isSet(new Set()); // true
172
+ ```
173
+
174
+ ### Math Utilities
175
+
176
+ ```typescript
177
+ import {
178
+ calculateEuclideanDistance,
179
+ calculateMovingSpeed,
180
+ calculatePercentage
181
+ } from '@react-hive/honey-utils';
182
+
183
+ // Calculate Euclidean distance between two points
184
+ calculateEuclideanDistance(0, 0, 3, 4); // 5
185
+
186
+ // Calculate moving speed
187
+ calculateMovingSpeed(100, 5); // 20
188
+
189
+ // Calculate percentage of a value
190
+ calculatePercentage(200, 25); // 50
191
+ ```
192
+
193
+ ### DOM Utilities
194
+
195
+ ```typescript
196
+ import { getTransformationValues } from '@react-hive/honey-utils';
197
+
198
+ // Get transformation values from an HTML element
199
+ const element = document.getElementById('my-element');
200
+ if (element) {
201
+ const { translateX, translateY } = getTransformationValues(element);
202
+
203
+ console.log(`Element is translated by ${translateX}px horizontally and ${translateY}px vertically`);
204
+ }
205
+ ```
206
+
207
+ ### Assert Function
208
+
209
+ ```typescript
210
+ import { assert } from '@react-hive/honey-utils';
211
+
212
+ // Assert a condition
213
+ function divide(a: number, b: number): number {
214
+ assert(b !== 0, 'Cannot divide by zero');
215
+ return a / b;
216
+ }
217
+ ```
218
+
219
+ ## API Documentation
220
+
221
+ ### String Utilities
222
+
223
+ - **toKebabCase(input: string): string** - Converts a string to kebab-case
224
+ - **camelToDashCase(input: string): string** - Converts camelCase to dash-case
225
+ - **splitStringIntoWords(input: string): string[]** - Splits a string into an array of words
226
+ - **hashString(input: string): string** - Generates a short hash from a string
227
+
228
+ ### Array Utilities
229
+
230
+ - **boolFilter<T>(array: (T | false | null | undefined)[]): T[]** - Filters out falsy values from an array
231
+
232
+ ### Function Utilities
233
+
234
+ - **noop(): void** - A no-operation function
235
+ - **invokeIfFunction<Args extends any[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args): Result** - Invokes the input if it's a function, otherwise returns it as-is
236
+
237
+ ### Type Guards
238
+
239
+ - **isString(value: unknown): value is string** - Checks if a value is a string
240
+ - **isNumber(value: unknown): value is number** - Checks if a value is a number
241
+ - **isBool(value: unknown): value is boolean** - Checks if a value is a boolean
242
+ - **isObject(value: unknown): value is object** - Checks if a value is an object
243
+ - **isFunction(value: unknown): value is Function** - Checks if a value is a function
244
+ - **isPromise<T = unknown>(value: unknown): value is Promise<T>** - Checks if a value is a Promise
245
+ - **isNil(value: unknown): value is null | undefined** - Checks if a value is null or undefined
246
+ - **isNilOrEmptyString(value: unknown): value is null | undefined** - Checks if a value is null, undefined, or an empty string
247
+ - **isArray(value: unknown): value is unknown[]** - Checks if a value is an array
248
+ - **isEmptyArray(value: unknown): value is []** - Checks if a value is an empty array
249
+ - **isEmptyObject(value: unknown): value is Record<string, never>** - Checks if a value is an empty object
250
+ - **isNull(value: unknown): value is null** - Checks if a value is null
251
+ - **isUndefined(value: unknown): value is undefined** - Checks if a value is undefined
252
+ - **isFiniteNumber(value: unknown): value is number** - Checks if a value is a finite number
253
+ - **isInteger(value: unknown): value is number** - Checks if a value is an integer
254
+ - **isNaN(value: unknown): boolean** - Checks if a value is NaN
255
+ - **isDate(value: unknown): value is Date** - Checks if a value is a Date object
256
+ - **isValidDate(value: unknown): value is Date** - Checks if a value is a valid Date object (not Invalid Date)
257
+ - **isRegExp(value: unknown): value is RegExp** - Checks if a value is a RegExp object
258
+ - **isMap(value: unknown): value is Map<unknown, unknown>** - Checks if a value is a Map
259
+ - **isSet(value: unknown): value is Set<unknown>** - Checks if a value is a Set
260
+ - **isSymbol(value: unknown): value is symbol** - Checks if a value is a Symbol
261
+
262
+ ### Math Utilities
263
+
264
+ - **calculateEuclideanDistance(startX: number, startY: number, endX: number, endY: number): number** - Calculates the Euclidean distance between two points
265
+ - **calculateMovingSpeed(delta: number, elapsedTime: number): number** - Calculates moving speed
266
+ - **calculatePercentage(value: number, percentage: number): number** - Calculates the specified percentage of a value
267
+
268
+ ### DOM Utilities
269
+
270
+ - **getTransformationValues(element: HTMLElement): { translateX: number, translateY: number }** - Gets transformation values from an HTML element
271
+
272
+ ### Other Utilities
273
+
274
+ - **assert(condition: any, message: string): asserts condition** - Asserts that a condition is truthy, throwing an error with the provided message if it's not
275
+
276
+ ## Contributing
277
+
278
+ Contributions are welcome! Please feel free to submit a Pull Request.
279
+
280
+ 1. Fork the repository
281
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
282
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
283
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
284
+ 5. Open a Pull Request
285
+
286
+ ## License
287
+
288
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
289
+
290
+ ## Author
291
+
292
+ Mykhailo Aliinyk <m.aliynik@gmail.com>
package/dist/guards.d.ts CHANGED
@@ -1,8 +1,84 @@
1
+ /**
2
+ * Checks if a value is null.
3
+ *
4
+ * @param value - The value to check.
5
+ *
6
+ * @returns `true` if the value is null; otherwise, `false`.
7
+ */
8
+ export declare const isNull: (value: unknown) => value is null;
9
+ /**
10
+ * Checks if a value is a string.
11
+ *
12
+ * @param value - The value to check.
13
+ *
14
+ * @returns `true` if the value is a string; otherwise, `false`.
15
+ */
1
16
  export declare const isString: (value: unknown) => value is string;
17
+ /**
18
+ * Checks if a value is a number.
19
+ *
20
+ * @param value - The value to check.
21
+ *
22
+ * @returns `true` if the value is a number; otherwise, `false`.
23
+ */
2
24
  export declare const isNumber: (value: unknown) => value is number;
25
+ /**
26
+ * Checks if a value is a boolean.
27
+ *
28
+ * @param value - The value to check.
29
+ *
30
+ * @returns `true` if the value is a boolean; otherwise, `false`.
31
+ */
3
32
  export declare const isBool: (value: unknown) => value is boolean;
33
+ /**
34
+ * Checks if a value is an object.
35
+ *
36
+ * @param value - The value to check.
37
+ *
38
+ * @returns `true` if the value is an object; otherwise, `false`.
39
+ */
4
40
  export declare const isObject: (value: unknown) => value is object;
41
+ /**
42
+ * Checks if a value is an empty object (no own enumerable properties).
43
+ *
44
+ * @param value - The value to check.
45
+ *
46
+ * @returns `true` if the value is an empty object; otherwise, `false`.
47
+ */
48
+ export declare const isEmptyObject: (value: unknown) => value is Record<string, never>;
49
+ /**
50
+ * Checks if a value is an array.
51
+ *
52
+ * @param value - The value to check.
53
+ *
54
+ * @returns `true` if the value is an array; otherwise, `false`.
55
+ */
56
+ export declare const isArray: (value: unknown) => value is unknown[];
57
+ /**
58
+ * Checks if a value is an empty array.
59
+ *
60
+ * @param value - The value to check.
61
+ *
62
+ * @returns `true` if the value is an empty array; otherwise, `false`.
63
+ */
64
+ export declare const isEmptyArray: (value: unknown) => value is [];
65
+ /**
66
+ * Checks if a value is a function.
67
+ *
68
+ * @param value - The value to check.
69
+ *
70
+ * @returns `true` if the value is a function; otherwise, `false`.
71
+ */
5
72
  export declare const isFunction: (value: unknown) => value is Function;
73
+ /**
74
+ * Checks if a value is a Promise.
75
+ *
76
+ * @template T - The type of the value that the Promise resolves to.
77
+ *
78
+ * @param value - The value to check.
79
+ *
80
+ * @returns `true` if the value is a Promise; otherwise, `false`.
81
+ */
6
82
  export declare const isPromise: <T = unknown>(value: unknown) => value is Promise<T>;
7
83
  /**
8
84
  * Checks if a value is null or undefined.
@@ -25,3 +101,75 @@ export declare const isNil: (value: unknown) => value is null | undefined;
25
101
  * @returns `true` if the value is empty; otherwise, `false`.
26
102
  */
27
103
  export declare const isNilOrEmptyString: (value: unknown) => value is null | undefined;
104
+ /**
105
+ * Checks if a value is a Date object.
106
+ *
107
+ * @param value - The value to check.
108
+ *
109
+ * @returns `true` if the value is a Date object; otherwise, `false`.
110
+ */
111
+ export declare const isDate: (value: unknown) => value is Date;
112
+ /**
113
+ * Checks if a value is a valid Date object (not Invalid Date).
114
+ *
115
+ * @param value - The value to check.
116
+ *
117
+ * @returns `true` if the value is a valid Date object; otherwise, `false`.
118
+ */
119
+ export declare const isValidDate: (value: unknown) => value is Date;
120
+ /**
121
+ * Checks if a value is a RegExp object.
122
+ *
123
+ * @param value - The value to check.
124
+ *
125
+ * @returns `true` if the value is a RegExp object; otherwise, `false`.
126
+ */
127
+ export declare const isRegExp: (value: unknown) => value is RegExp;
128
+ /**
129
+ * Checks if a value is a Map.
130
+ *
131
+ * @param value - The value to check.
132
+ *
133
+ * @returns `true` if the value is a Map; otherwise, `false`.
134
+ */
135
+ export declare const isMap: (value: unknown) => value is Map<unknown, unknown>;
136
+ /**
137
+ * Checks if a value is a Set.
138
+ *
139
+ * @param value - The value to check.
140
+ *
141
+ * @returns `true` if the value is a Set; otherwise, `false`.
142
+ */
143
+ export declare const isSet: (value: unknown) => value is Set<unknown>;
144
+ /**
145
+ * Checks if a value is a Symbol.
146
+ *
147
+ * @param value - The value to check.
148
+ *
149
+ * @returns `true` if the value is a Symbol; otherwise, `false`.
150
+ */
151
+ export declare const isSymbol: (value: unknown) => value is symbol;
152
+ /**
153
+ * Checks if a value is undefined.
154
+ *
155
+ * @param value - The value to check.
156
+ *
157
+ * @returns `true` if the value is undefined; otherwise, `false`.
158
+ */
159
+ export declare const isUndefined: (value: unknown) => value is undefined;
160
+ /**
161
+ * Checks if a value is a finite number.
162
+ *
163
+ * @param value - The value to check.
164
+ *
165
+ * @returns `true` if the value is a finite number; otherwise, `false`.
166
+ */
167
+ export declare const isFiniteNumber: (value: unknown) => value is number;
168
+ /**
169
+ * Checks if a value is an integer.
170
+ *
171
+ * @param value - The value to check.
172
+ *
173
+ * @returns `true` if the value is an integer; otherwise, `false`.
174
+ */
175
+ export declare const isInteger: (value: unknown) => value is number;
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{assert:()=>O,boolFilter:()=>l,calculateEuclideanDistance:()=>m,calculateMovingSpeed:()=>S,calculatePercentage:()=>h,camelToDashCase:()=>r,getTransformationValues:()=>w,hashString:()=>a,invokeIfFunction:()=>s,isBool:()=>p,isFunction:()=>g,isNil:()=>b,isNilOrEmptyString:()=>d,isNumber:()=>u,isObject:()=>f,isPromise:()=>y,isString:()=>c,noop:()=>i,splitStringIntoWords:()=>n,toKebabCase:()=>o});const o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),n=e=>e.split(" ").filter(Boolean),a=e=>{let t=5381;for(let o=0;o<e.length;o++)t=33*t^e.charCodeAt(o);return(t>>>0).toString(36)},l=e=>e.filter(Boolean),i=()=>{},s=(e,...t)=>"function"==typeof e?e(...t):e,c=e=>"string"==typeof e,u=e=>"number"==typeof e,p=e=>"boolean"==typeof e,f=e=>"object"==typeof e,g=e=>"function"==typeof e,y=e=>g(e?.then),b=e=>null==e,d=e=>""===e||b(e),m=(e,t,o,r)=>{const n=o-e,a=r-t;return Math.sqrt(n**2+a**2)},S=(e,t)=>Math.abs(e/t),h=(e,t)=>e*t/100,w=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0};const o=t[1].split(", ");return{translateX:parseFloat(o[4]),translateY:parseFloat(o[5])}};function O(e,t){if(!e)throw new Error(t)}module.exports=t})();
1
+ (()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{assert:()=>I,boolFilter:()=>a,calculateEuclideanDistance:()=>C,calculateMovingSpeed:()=>D,calculatePercentage:()=>T,camelToDashCase:()=>r,getTransformationValues:()=>x,hashString:()=>n,invokeIfFunction:()=>l,isArray:()=>b,isBool:()=>f,isDate:()=>j,isEmptyArray:()=>m,isEmptyObject:()=>g,isFiniteNumber:()=>M,isFunction:()=>d,isInteger:()=>P,isMap:()=>w,isNil:()=>h,isNilOrEmptyString:()=>O,isNull:()=>c,isNumber:()=>u,isObject:()=>y,isPromise:()=>S,isRegExp:()=>v,isSet:()=>A,isString:()=>p,isSymbol:()=>E,isUndefined:()=>F,isValidDate:()=>N,noop:()=>s,splitStringIntoWords:()=>i,toKebabCase:()=>o});const o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),i=e=>e.split(" ").filter(Boolean),n=e=>{let t=5381;for(let o=0;o<e.length;o++)t=33*t^e.charCodeAt(o);return(t>>>0).toString(36)},a=e=>e.filter(Boolean),s=()=>{},l=(e,...t)=>"function"==typeof e?e(...t):e,c=e=>null===e,p=e=>"string"==typeof e,u=e=>"number"==typeof e,f=e=>"boolean"==typeof e,y=e=>"object"==typeof e,g=e=>y(e)&&!c(e)&&0===Object.keys(e).length,b=e=>Array.isArray(e),m=e=>b(e)&&0===e.length,d=e=>"function"==typeof e,S=e=>d(e?.then),h=e=>null==e,O=e=>""===e||h(e),j=e=>e instanceof Date,N=e=>j(e)&&!isNaN(e.getTime()),v=e=>e instanceof RegExp,w=e=>e instanceof Map,A=e=>e instanceof Set,E=e=>"symbol"==typeof e,F=e=>void 0===e,M=e=>u(e)&&isFinite(e),P=e=>u(e)&&Number.isInteger(e),C=(e,t,o,r)=>{const i=o-e,n=r-t;return Math.sqrt(i**2+n**2)},D=(e,t)=>Math.abs(e/t),T=(e,t)=>e*t/100,x=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0};const o=t[1].split(", ");return{translateX:parseFloat(o[4]),translateY:parseFloat(o[5])}};function I(e,t){if(!e)throw new Error(t)}module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,6ZCLhD,MAAMC,EAAeC,GAC1BA,EAAMC,QAAQ,qBAAsB,SAASC,cAElCC,EAAmBH,GAC9BA,EAAMC,QAAQ,SAAUG,GAAU,IAAIA,EAAOF,iBASlCG,EAAwBL,GAA4BA,EAAMM,MAAM,KAAKC,OAAOC,SA0B5EC,EAAcT,IACzB,IAAIU,EAAO,KAEX,IAAK,IAAIC,EAAI,EAAGA,EAAIX,EAAMY,OAAQD,IAChCD,EAAe,GAAPA,EAAaV,EAAMa,WAAWF,GAGxC,OAAQD,IAAS,GAAGI,SAAS,KClClBC,EAAiBC,GAC5BA,EAAMT,OAAOC,SCbFS,EAAO,OAcPC,EAAmB,CAC9BlB,KACGmB,IAC0B,mBAAVnB,EAAwBA,KAAuCmB,GAAQnB,ECjB/EoB,EAAYtB,GAAqD,iBAAVA,EAEvDuB,EAAYvB,GAAqD,iBAAVA,EAEvDwB,EAAUxB,GAAsD,kBAAVA,EAEtDyB,EAAYzB,GAAqD,iBAAVA,EAEvD0B,EAAc1B,GAAoC,mBAAVA,EAExC2B,EAA0B3B,GACrC0B,EAAY1B,GAAsB4B,MASvBC,EAAS7B,GACpBA,QAcW8B,EAAsB9B,GACvB,KAAVA,GAAgB6B,EAAM7B,GC1BX+B,EAA6B,CACxCC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAASF,EAAOF,EAChBK,EAASF,EAAOF,EAEtB,OAAOK,KAAKC,KAAKH,GAAU,EAAIC,GAAU,IAW9BG,EAAuB,CAACC,EAAeC,IAClDJ,KAAKK,IAAIF,EAAQC,GAUNE,EAAsB,CAAC5C,EAAe6C,IACzC7C,EAAQ6C,EAAc,IC9BnBC,EAA2BC,IACtC,MAGMC,EAHiBC,OAAOC,iBAAiBH,GACTI,iBAAiB,aAEzBC,MAAM,oBACpC,IAAKJ,EACH,MAAO,CACLK,WAAY,EACZC,WAAY,GAIhB,MAAMC,EAAkBP,EAAO,GAAGxC,MAAM,MAKxC,MAAO,CACL6C,WAJiBG,WAAWD,EAAgB,IAK5CD,WAJiBE,WAAWD,EAAgB,MCpBzC,SAASE,EAAOC,EAAgBC,GACrC,IAAKD,EACH,MAAM,IAAIE,MAAMD,EAEpB,C","sources":["webpack://@react-hive/honey-utils/webpack/bootstrap","webpack://@react-hive/honey-utils/webpack/runtime/define property getters","webpack://@react-hive/honey-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-utils/webpack/runtime/make namespace object","webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","export const isString = (value: unknown): value is string => typeof value === 'string';\n\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","toKebabCase","input","replace","toLowerCase","camelToDashCase","letter","splitStringIntoWords","split","filter","Boolean","hashString","hash","i","length","charCodeAt","toString","boolFilter","array","noop","invokeIfFunction","args","isString","isNumber","isBool","isObject","isFunction","isPromise","then","isNil","isNilOrEmptyString","calculateEuclideanDistance","startX","startY","endX","endY","deltaX","deltaY","Math","sqrt","calculateMovingSpeed","delta","elapsedTime","abs","calculatePercentage","percentage","getTransformationValues","element","matrix","window","getComputedStyle","getPropertyValue","match","translateX","translateY","transformMatrix","parseFloat","assert","condition","message","Error"],"sourceRoot":""}
1
+ {"version":3,"file":"index.cjs","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,2mBCLhD,MAAMC,EAAeC,GAC1BA,EAAMC,QAAQ,qBAAsB,SAASC,cAElCC,EAAmBH,GAC9BA,EAAMC,QAAQ,SAAUG,GAAU,IAAIA,EAAOF,iBASlCG,EAAwBL,GAA4BA,EAAMM,MAAM,KAAKC,OAAOC,SA0B5EC,EAAcT,IACzB,IAAIU,EAAO,KAEX,IAAK,IAAIC,EAAI,EAAGA,EAAIX,EAAMY,OAAQD,IAChCD,EAAe,GAAPA,EAAaV,EAAMa,WAAWF,GAGxC,OAAQD,IAAS,GAAGI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qE,IACzCrE,EAAQqE,EAAc,IC9BnBC,EAA2BC,IACtC,MAGMC,EAHiBC,OAAOC,iBAAiBH,GACTI,iBAAiB,aAEzBC,MAAM,oBACpC,IAAKJ,EACH,MAAO,CACLK,WAAY,EACZC,WAAY,GAIhB,MAAMC,EAAkBP,EAAO,GAAGhE,MAAM,MAKxC,MAAO,CACLqE,WAJiBG,WAAWD,EAAgB,IAK5CD,WAJiBE,WAAWD,EAAgB,MCpBzC,SAASE,EAAOC,EAAgBC,GACrC,IAAKD,EACH,MAAM,IAAIE,MAAMD,EAEpB,C","sources":["webpack://@react-hive/honey-utils/webpack/bootstrap","webpack://@react-hive/honey-utils/webpack/runtime/define property getters","webpack://@react-hive/honey-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-utils/webpack/runtime/make namespace object","webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","/**\n * Checks if a value is null.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is null; otherwise, `false`.\n */\nexport const isNull = (value: unknown): value is null => value === null;\n\n/**\n * Checks if a value is a string.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a string; otherwise, `false`.\n */\nexport const isString = (value: unknown): value is string => typeof value === 'string';\n\n/**\n * Checks if a value is a number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a number; otherwise, `false`.\n */\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\n/**\n * Checks if a value is a boolean.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a boolean; otherwise, `false`.\n */\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\n/**\n * Checks if a value is an object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an object; otherwise, `false`.\n */\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\n/**\n * Checks if a value is an empty object (no own enumerable properties).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty object; otherwise, `false`.\n */\nexport const isEmptyObject = (value: unknown): value is Record<string, never> =>\n isObject(value) && !isNull(value) && Object.keys(value).length === 0;\n\n/**\n * Checks if a value is an array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an array; otherwise, `false`.\n */\nexport const isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n\n/**\n * Checks if a value is an empty array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty array; otherwise, `false`.\n */\nexport const isEmptyArray = (value: unknown): value is [] => isArray(value) && value.length === 0;\n\n/**\n * Checks if a value is a function.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a function; otherwise, `false`.\n */\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\n/**\n * Checks if a value is a Promise.\n *\n * @template T - The type of the value that the Promise resolves to.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Promise; otherwise, `false`.\n */\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n\n/**\n * Checks if a value is a Date object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Date object; otherwise, `false`.\n */\nexport const isDate = (value: unknown): value is Date => value instanceof Date;\n\n/**\n * Checks if a value is a valid Date object (not Invalid Date).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a valid Date object; otherwise, `false`.\n */\nexport const isValidDate = (value: unknown): value is Date =>\n isDate(value) && !isNaN(value.getTime());\n\n/**\n * Checks if a value is a RegExp object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a RegExp object; otherwise, `false`.\n */\nexport const isRegExp = (value: unknown): value is RegExp => value instanceof RegExp;\n\n/**\n * Checks if a value is a Map.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Map; otherwise, `false`.\n */\nexport const isMap = (value: unknown): value is Map<unknown, unknown> => value instanceof Map;\n\n/**\n * Checks if a value is a Set.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Set; otherwise, `false`.\n */\nexport const isSet = (value: unknown): value is Set<unknown> => value instanceof Set;\n\n/**\n * Checks if a value is a Symbol.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Symbol; otherwise, `false`.\n */\nexport const isSymbol = (value: unknown): value is symbol => typeof value === 'symbol';\n\n/**\n * Checks if a value is undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is undefined; otherwise, `false`.\n */\nexport const isUndefined = (value: unknown): value is undefined => value === undefined;\n\n/**\n * Checks if a value is a finite number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a finite number; otherwise, `false`.\n */\nexport const isFiniteNumber = (value: unknown): value is number =>\n isNumber(value) && isFinite(value);\n\n/**\n * Checks if a value is an integer.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an integer; otherwise, `false`.\n */\nexport const isInteger = (value: unknown): value is number =>\n isNumber(value) && Number.isInteger(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","toKebabCase","input","replace","toLowerCase","camelToDashCase","letter","splitStringIntoWords","split","filter","Boolean","hashString","hash","i","length","charCodeAt","toString","boolFilter","array","noop","invokeIfFunction","args","isNull","isString","isNumber","isBool","isObject","isEmptyObject","keys","isArray","Array","isEmptyArray","isFunction","isPromise","then","isNil","isNilOrEmptyString","isDate","Date","isValidDate","isNaN","getTime","isRegExp","RegExp","isMap","Map","isSet","Set","isSymbol","isUndefined","undefined","isFiniteNumber","isFinite","isInteger","Number","calculateEuclideanDistance","startX","startY","endX","endY","deltaX","deltaY","Math","sqrt","calculateMovingSpeed","delta","elapsedTime","abs","calculatePercentage","percentage","getTransformationValues","element","matrix","window","getComputedStyle","getPropertyValue","match","translateX","translateY","transformMatrix","parseFloat","assert","condition","message","Error"],"sourceRoot":""}
@@ -105,20 +105,109 @@ const invokeIfFunction = (input, ...args) => (typeof input === 'function' ? inpu
105
105
 
106
106
  __webpack_require__.r(__webpack_exports__);
107
107
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
108
+ /* harmony export */ isArray: () => (/* binding */ isArray),
108
109
  /* harmony export */ isBool: () => (/* binding */ isBool),
110
+ /* harmony export */ isDate: () => (/* binding */ isDate),
111
+ /* harmony export */ isEmptyArray: () => (/* binding */ isEmptyArray),
112
+ /* harmony export */ isEmptyObject: () => (/* binding */ isEmptyObject),
113
+ /* harmony export */ isFiniteNumber: () => (/* binding */ isFiniteNumber),
109
114
  /* harmony export */ isFunction: () => (/* binding */ isFunction),
115
+ /* harmony export */ isInteger: () => (/* binding */ isInteger),
116
+ /* harmony export */ isMap: () => (/* binding */ isMap),
110
117
  /* harmony export */ isNil: () => (/* binding */ isNil),
111
118
  /* harmony export */ isNilOrEmptyString: () => (/* binding */ isNilOrEmptyString),
119
+ /* harmony export */ isNull: () => (/* binding */ isNull),
112
120
  /* harmony export */ isNumber: () => (/* binding */ isNumber),
113
121
  /* harmony export */ isObject: () => (/* binding */ isObject),
114
122
  /* harmony export */ isPromise: () => (/* binding */ isPromise),
115
- /* harmony export */ isString: () => (/* binding */ isString)
123
+ /* harmony export */ isRegExp: () => (/* binding */ isRegExp),
124
+ /* harmony export */ isSet: () => (/* binding */ isSet),
125
+ /* harmony export */ isString: () => (/* binding */ isString),
126
+ /* harmony export */ isSymbol: () => (/* binding */ isSymbol),
127
+ /* harmony export */ isUndefined: () => (/* binding */ isUndefined),
128
+ /* harmony export */ isValidDate: () => (/* binding */ isValidDate)
116
129
  /* harmony export */ });
130
+ /**
131
+ * Checks if a value is null.
132
+ *
133
+ * @param value - The value to check.
134
+ *
135
+ * @returns `true` if the value is null; otherwise, `false`.
136
+ */
137
+ const isNull = (value) => value === null;
138
+ /**
139
+ * Checks if a value is a string.
140
+ *
141
+ * @param value - The value to check.
142
+ *
143
+ * @returns `true` if the value is a string; otherwise, `false`.
144
+ */
117
145
  const isString = (value) => typeof value === 'string';
146
+ /**
147
+ * Checks if a value is a number.
148
+ *
149
+ * @param value - The value to check.
150
+ *
151
+ * @returns `true` if the value is a number; otherwise, `false`.
152
+ */
118
153
  const isNumber = (value) => typeof value === 'number';
154
+ /**
155
+ * Checks if a value is a boolean.
156
+ *
157
+ * @param value - The value to check.
158
+ *
159
+ * @returns `true` if the value is a boolean; otherwise, `false`.
160
+ */
119
161
  const isBool = (value) => typeof value === 'boolean';
162
+ /**
163
+ * Checks if a value is an object.
164
+ *
165
+ * @param value - The value to check.
166
+ *
167
+ * @returns `true` if the value is an object; otherwise, `false`.
168
+ */
120
169
  const isObject = (value) => typeof value === 'object';
170
+ /**
171
+ * Checks if a value is an empty object (no own enumerable properties).
172
+ *
173
+ * @param value - The value to check.
174
+ *
175
+ * @returns `true` if the value is an empty object; otherwise, `false`.
176
+ */
177
+ const isEmptyObject = (value) => isObject(value) && !isNull(value) && Object.keys(value).length === 0;
178
+ /**
179
+ * Checks if a value is an array.
180
+ *
181
+ * @param value - The value to check.
182
+ *
183
+ * @returns `true` if the value is an array; otherwise, `false`.
184
+ */
185
+ const isArray = (value) => Array.isArray(value);
186
+ /**
187
+ * Checks if a value is an empty array.
188
+ *
189
+ * @param value - The value to check.
190
+ *
191
+ * @returns `true` if the value is an empty array; otherwise, `false`.
192
+ */
193
+ const isEmptyArray = (value) => isArray(value) && value.length === 0;
194
+ /**
195
+ * Checks if a value is a function.
196
+ *
197
+ * @param value - The value to check.
198
+ *
199
+ * @returns `true` if the value is a function; otherwise, `false`.
200
+ */
121
201
  const isFunction = (value) => typeof value === 'function';
202
+ /**
203
+ * Checks if a value is a Promise.
204
+ *
205
+ * @template T - The type of the value that the Promise resolves to.
206
+ *
207
+ * @param value - The value to check.
208
+ *
209
+ * @returns `true` if the value is a Promise; otherwise, `false`.
210
+ */
122
211
  const isPromise = (value) => isFunction(value?.then);
123
212
  /**
124
213
  * Checks if a value is null or undefined.
@@ -141,6 +230,78 @@ const isNil = (value) => value === undefined || value === null;
141
230
  * @returns `true` if the value is empty; otherwise, `false`.
142
231
  */
143
232
  const isNilOrEmptyString = (value) => value === '' || isNil(value);
233
+ /**
234
+ * Checks if a value is a Date object.
235
+ *
236
+ * @param value - The value to check.
237
+ *
238
+ * @returns `true` if the value is a Date object; otherwise, `false`.
239
+ */
240
+ const isDate = (value) => value instanceof Date;
241
+ /**
242
+ * Checks if a value is a valid Date object (not Invalid Date).
243
+ *
244
+ * @param value - The value to check.
245
+ *
246
+ * @returns `true` if the value is a valid Date object; otherwise, `false`.
247
+ */
248
+ const isValidDate = (value) => isDate(value) && !isNaN(value.getTime());
249
+ /**
250
+ * Checks if a value is a RegExp object.
251
+ *
252
+ * @param value - The value to check.
253
+ *
254
+ * @returns `true` if the value is a RegExp object; otherwise, `false`.
255
+ */
256
+ const isRegExp = (value) => value instanceof RegExp;
257
+ /**
258
+ * Checks if a value is a Map.
259
+ *
260
+ * @param value - The value to check.
261
+ *
262
+ * @returns `true` if the value is a Map; otherwise, `false`.
263
+ */
264
+ const isMap = (value) => value instanceof Map;
265
+ /**
266
+ * Checks if a value is a Set.
267
+ *
268
+ * @param value - The value to check.
269
+ *
270
+ * @returns `true` if the value is a Set; otherwise, `false`.
271
+ */
272
+ const isSet = (value) => value instanceof Set;
273
+ /**
274
+ * Checks if a value is a Symbol.
275
+ *
276
+ * @param value - The value to check.
277
+ *
278
+ * @returns `true` if the value is a Symbol; otherwise, `false`.
279
+ */
280
+ const isSymbol = (value) => typeof value === 'symbol';
281
+ /**
282
+ * Checks if a value is undefined.
283
+ *
284
+ * @param value - The value to check.
285
+ *
286
+ * @returns `true` if the value is undefined; otherwise, `false`.
287
+ */
288
+ const isUndefined = (value) => value === undefined;
289
+ /**
290
+ * Checks if a value is a finite number.
291
+ *
292
+ * @param value - The value to check.
293
+ *
294
+ * @returns `true` if the value is a finite number; otherwise, `false`.
295
+ */
296
+ const isFiniteNumber = (value) => isNumber(value) && isFinite(value);
297
+ /**
298
+ * Checks if a value is an integer.
299
+ *
300
+ * @param value - The value to check.
301
+ *
302
+ * @returns `true` if the value is an integer; otherwise, `false`.
303
+ */
304
+ const isInteger = (value) => isNumber(value) && Number.isInteger(value);
144
305
 
145
306
 
146
307
  /***/ }),
@@ -327,14 +488,27 @@ __webpack_require__.r(__webpack_exports__);
327
488
  /* harmony export */ getTransformationValues: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_5__.getTransformationValues),
328
489
  /* harmony export */ hashString: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_0__.hashString),
329
490
  /* harmony export */ invokeIfFunction: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_2__.invokeIfFunction),
491
+ /* harmony export */ isArray: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isArray),
330
492
  /* harmony export */ isBool: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isBool),
493
+ /* harmony export */ isDate: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isDate),
494
+ /* harmony export */ isEmptyArray: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isEmptyArray),
495
+ /* harmony export */ isEmptyObject: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isEmptyObject),
496
+ /* harmony export */ isFiniteNumber: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isFiniteNumber),
331
497
  /* harmony export */ isFunction: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isFunction),
498
+ /* harmony export */ isInteger: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isInteger),
499
+ /* harmony export */ isMap: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isMap),
332
500
  /* harmony export */ isNil: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isNil),
333
501
  /* harmony export */ isNilOrEmptyString: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isNilOrEmptyString),
502
+ /* harmony export */ isNull: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isNull),
334
503
  /* harmony export */ isNumber: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isNumber),
335
504
  /* harmony export */ isObject: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isObject),
336
505
  /* harmony export */ isPromise: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isPromise),
506
+ /* harmony export */ isRegExp: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isRegExp),
507
+ /* harmony export */ isSet: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isSet),
337
508
  /* harmony export */ isString: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isString),
509
+ /* harmony export */ isSymbol: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isSymbol),
510
+ /* harmony export */ isUndefined: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isUndefined),
511
+ /* harmony export */ isValidDate: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_3__.isValidDate),
338
512
  /* harmony export */ noop: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_2__.noop),
339
513
  /* harmony export */ splitStringIntoWords: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_0__.splitStringIntoWords),
340
514
  /* harmony export */ toKebabCase: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_0__.toKebabCase)
@@ -1 +1 @@
1
- {"version":3,"file":"index.dev.cjs","mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,UAAU,GAAG,CAAI,KAAuC,EAAO,EAAE,CAC5E,KAAK,CAAC,MAAM,CAAC,OAAO,CAAQ,CAAC;;;;;;;;;;;;;;;ACR/B;;;;;;GAMG;AACI,MAAM,uBAAuB,GAAG,CAAC,OAAoB,EAAmC,EAAE;IAC/F,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,cAAc,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEpE,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;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AC,CAAC;AAEhE;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAY,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE;IAClD,IAAI,IAAI,GAAG,IAAI,CAAC;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC;;;;;;;UC/CF;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNyB;AACD;AACG;AACF;AACF;AACD;AAEf,SAAS,MAAM,CAAC,SAAc,EAAE,OAAe;IACpD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC","sources":["webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/webpack/bootstrap","webpack://@react-hive/honey-utils/webpack/runtime/define property getters","webpack://@react-hive/honey-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-utils/webpack/runtime/make namespace object","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","export const isString = (value: unknown): value is string => typeof value === 'string';\n\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"index.dev.cjs","mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,UAAU,GAAG,CAAI,KAAuC,EAAO,EAAE,CAC5E,KAAK,CAAC,MAAM,CAAC,OAAO,CAAQ,CAAC;;;;;;;;;;;;;;;ACR/B;;;;;;GAMG;AACI,MAAM,uBAAuB,GAAG,CAAC,OAAoB,EAAmC,EAAE;IAC/F,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,cAAc,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEpE,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,UAAU,EAAE,CAAC;YACb,UAAU,EAAE,CAAC;SACd,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9C,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC,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C,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC","sources":["webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/webpack/bootstrap","webpack://@react-hive/honey-utils/webpack/runtime/define property getters","webpack://@react-hive/honey-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-utils/webpack/runtime/make namespace object","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","/**\n * Checks if a value is null.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is null; otherwise, `false`.\n */\nexport const isNull = (value: unknown): value is null => value === null;\n\n/**\n * Checks if a value is a string.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a string; otherwise, `false`.\n */\nexport const isString = (value: unknown): value is string => typeof value === 'string';\n\n/**\n * Checks if a value is a number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a number; otherwise, `false`.\n */\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\n/**\n * Checks if a value is a boolean.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a boolean; otherwise, `false`.\n */\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\n/**\n * Checks if a value is an object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an object; otherwise, `false`.\n */\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\n/**\n * Checks if a value is an empty object (no own enumerable properties).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty object; otherwise, `false`.\n */\nexport const isEmptyObject = (value: unknown): value is Record<string, never> =>\n isObject(value) && !isNull(value) && Object.keys(value).length === 0;\n\n/**\n * Checks if a value is an array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an array; otherwise, `false`.\n */\nexport const isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n\n/**\n * Checks if a value is an empty array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty array; otherwise, `false`.\n */\nexport const isEmptyArray = (value: unknown): value is [] => isArray(value) && value.length === 0;\n\n/**\n * Checks if a value is a function.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a function; otherwise, `false`.\n */\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\n/**\n * Checks if a value is a Promise.\n *\n * @template T - The type of the value that the Promise resolves to.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Promise; otherwise, `false`.\n */\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n\n/**\n * Checks if a value is a Date object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Date object; otherwise, `false`.\n */\nexport const isDate = (value: unknown): value is Date => value instanceof Date;\n\n/**\n * Checks if a value is a valid Date object (not Invalid Date).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a valid Date object; otherwise, `false`.\n */\nexport const isValidDate = (value: unknown): value is Date =>\n isDate(value) && !isNaN(value.getTime());\n\n/**\n * Checks if a value is a RegExp object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a RegExp object; otherwise, `false`.\n */\nexport const isRegExp = (value: unknown): value is RegExp => value instanceof RegExp;\n\n/**\n * Checks if a value is a Map.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Map; otherwise, `false`.\n */\nexport const isMap = (value: unknown): value is Map<unknown, unknown> => value instanceof Map;\n\n/**\n * Checks if a value is a Set.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Set; otherwise, `false`.\n */\nexport const isSet = (value: unknown): value is Set<unknown> => value instanceof Set;\n\n/**\n * Checks if a value is a Symbol.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Symbol; otherwise, `false`.\n */\nexport const isSymbol = (value: unknown): value is symbol => typeof value === 'symbol';\n\n/**\n * Checks if a value is undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is undefined; otherwise, `false`.\n */\nexport const isUndefined = (value: unknown): value is undefined => value === undefined;\n\n/**\n * Checks if a value is a finite number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a finite number; otherwise, `false`.\n */\nexport const isFiniteNumber = (value: unknown): value is number =>\n isNumber(value) && isFinite(value);\n\n/**\n * Checks if a value is an integer.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an integer; otherwise, `false`.\n */\nexport const isInteger = (value: unknown): value is number =>\n isNumber(value) && Number.isInteger(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":[],"sourceRoot":""}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const t=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),e=t=>t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),o=t=>t.split(" ").filter(Boolean),r=t=>{let e=5381;for(let o=0;o<t.length;o++)e=33*e^t.charCodeAt(o);return(e>>>0).toString(36)},n=t=>t.filter(Boolean),a=()=>{},l=(t,...e)=>"function"==typeof t?t(...e):t,s=t=>"string"==typeof t,f=t=>"number"==typeof t,p=t=>"boolean"==typeof t,i=t=>"object"==typeof t,c=t=>"function"==typeof t,u=t=>c(t?.then),y=t=>null==t,g=t=>""===t||y(t),h=(t,e,o,r)=>{const n=o-t,a=r-e;return Math.sqrt(n**2+a**2)},w=(t,e)=>Math.abs(t/e),m=(t,e)=>t*e/100,b=t=>{const e=window.getComputedStyle(t).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!e)return{translateX:0,translateY:0};const o=e[1].split(", ");return{translateX:parseFloat(o[4]),translateY:parseFloat(o[5])}};function C(t,e){if(!t)throw new Error(e)}export{C as assert,n as boolFilter,h as calculateEuclideanDistance,w as calculateMovingSpeed,m as calculatePercentage,e as camelToDashCase,b as getTransformationValues,r as hashString,l as invokeIfFunction,p as isBool,c as isFunction,y as isNil,g as isNilOrEmptyString,f as isNumber,i as isObject,u as isPromise,s as isString,a as noop,o as splitStringIntoWords,t as toKebabCase};
1
+ const t=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),e=t=>t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),n=t=>t.split(" ").filter(Boolean),o=t=>{let e=5381;for(let n=0;n<t.length;n++)e=33*e^t.charCodeAt(n);return(e>>>0).toString(36)},r=t=>t.filter(Boolean),a=()=>{},s=(t,...e)=>"function"==typeof t?t(...e):t,l=t=>null===t,i=t=>"string"==typeof t,f=t=>"number"==typeof t,p=t=>"boolean"==typeof t,c=t=>"object"==typeof t,u=t=>c(t)&&!l(t)&&0===Object.keys(t).length,y=t=>Array.isArray(t),g=t=>y(t)&&0===t.length,h=t=>"function"==typeof t,m=t=>h(t?.then),b=t=>null==t,w=t=>""===t||b(t),A=t=>t instanceof Date,d=t=>A(t)&&!isNaN(t.getTime()),C=t=>t instanceof RegExp,$=t=>t instanceof Map,x=t=>t instanceof Set,F=t=>"symbol"==typeof t,M=t=>void 0===t,N=t=>f(t)&&isFinite(t),S=t=>f(t)&&Number.isInteger(t),j=(t,e,n,o)=>{const r=n-t,a=o-e;return Math.sqrt(r**2+a**2)},B=(t,e)=>Math.abs(t/e),E=(t,e)=>t*e/100,L=t=>{const e=window.getComputedStyle(t).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!e)return{translateX:0,translateY:0};const n=e[1].split(", ");return{translateX:parseFloat(n[4]),translateY:parseFloat(n[5])}};function X(t,e){if(!t)throw new Error(e)}export{X as assert,r as boolFilter,j as calculateEuclideanDistance,B as calculateMovingSpeed,E as calculatePercentage,e as camelToDashCase,L as getTransformationValues,o as hashString,s as invokeIfFunction,y as isArray,p as isBool,A as isDate,g as isEmptyArray,u as isEmptyObject,N as isFiniteNumber,h as isFunction,S as isInteger,$ as isMap,b as isNil,w as isNilOrEmptyString,l as isNull,f as isNumber,c as isObject,m as isPromise,C as isRegExp,x as isSet,i as isString,F as isSymbol,M as isUndefined,d as isValidDate,a as noop,n as splitStringIntoWords,t as toKebabCase};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","mappings":"AAAO,MAAMA,EAAeC,GAC1BA,EAAMC,QAAQ,qBAAsB,SAASC,cAElCC,EAAmBH,GAC9BA,EAAMC,QAAQ,SAAUG,GAAU,IAAIA,EAAOF,iBASlCG,EAAwBL,GAA4BA,EAAMM,MAAM,KAAKC,OAAOC,SA0B5EC,EAAcT,IACzB,IAAIU,EAAO,KAEX,IAAK,IAAIC,EAAI,EAAGA,EAAIX,EAAMY,OAAQD,IAChCD,EAAe,GAAPA,EAAaV,EAAMa,WAAWF,GAGxC,OAAQD,IAAS,GAAGI,SAAS,KClClBC,EAAiBC,GAC5BA,EAAMT,OAAOC,SCbFS,EAAO,OAcPC,EAAmB,CAC9BlB,KACGmB,IAC0B,mBAAVnB,EAAwBA,KAAuCmB,GAAQnB,ECjB/EoB,EAAYC,GAAqD,iBAAVA,EAEvDC,EAAYD,GAAqD,iBAAVA,EAEvDE,EAAUF,GAAsD,kBAAVA,EAEtDG,EAAYH,GAAqD,iBAAVA,EAEvDI,EAAcJ,GAAoC,mBAAVA,EAExCK,EAA0BL,GACrCI,EAAYJ,GAAsBM,MASvBC,EAASP,GACpBA,QAcWQ,EAAsBR,GACvB,KAAVA,GAAgBO,EAAMP,GC1BXS,EAA6B,CACxCC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAASF,EAAOF,EAChBK,EAASF,EAAOF,EAEtB,OAAOK,KAAKC,KAAKH,GAAU,EAAIC,GAAU,IAW9BG,EAAuB,CAACC,EAAeC,IAClDJ,KAAKK,IAAIF,EAAQC,GAUNE,EAAsB,CAACtB,EAAeuB,IACzCvB,EAAQuB,EAAc,IC9BnBC,EAA2BC,IACtC,MAGMC,EAHiBC,OAAOC,iBAAiBH,GACTI,iBAAiB,aAEzBC,MAAM,oBACpC,IAAKJ,EACH,MAAO,CACLK,WAAY,EACZC,WAAY,GAIhB,MAAMC,EAAkBP,EAAO,GAAGzC,MAAM,MAKxC,MAAO,CACL8C,WAJiBG,WAAWD,EAAgB,IAK5CD,WAJiBE,WAAWD,EAAgB,MCpBzC,SAASE,EAAOC,EAAgBC,GACrC,IAAKD,EACH,MAAM,IAAIE,MAAMD,EAEpB,Q","sources":["webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","export const isString = (value: unknown): value is string => typeof value === 'string';\n\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":["toKebabCase","input","replace","toLowerCase","camelToDashCase","letter","splitStringIntoWords","split","filter","Boolean","hashString","hash","i","length","charCodeAt","toString","boolFilter","array","noop","invokeIfFunction","args","isString","value","isNumber","isBool","isObject","isFunction","isPromise","then","isNil","isNilOrEmptyString","calculateEuclideanDistance","startX","startY","endX","endY","deltaX","deltaY","Math","sqrt","calculateMovingSpeed","delta","elapsedTime","abs","calculatePercentage","percentage","getTransformationValues","element","matrix","window","getComputedStyle","getPropertyValue","match","translateX","translateY","transformMatrix","parseFloat","assert","condition","message","Error"],"sourceRoot":""}
1
+ {"version":3,"file":"index.mjs","mappings":"AAAO,MAAMA,EAAeC,GAC1BA,EAAMC,QAAQ,qBAAsB,SAASC,cAElCC,EAAmBH,GAC9BA,EAAMC,QAAQ,SAAUG,GAAU,IAAIA,EAAOF,iBASlCG,EAAwBL,GAA4BA,EAAMM,MAAM,KAAKC,OAAOC,SA0B5EC,EAAcT,IACzB,IAAIU,EAAO,KAEX,IAAK,IAAIC,EAAI,EAAGA,EAAIX,EAAMY,OAAQD,IAChCD,EAAe,GAAPA,EAAaV,EAAMa,WAAWF,GAGxC,OAAQD,IAAS,GAAGI,SAAS,KClClBC,EAAiBC,GAC5BA,EAAMT,OAAOC,SCbFS,EAAO,OAcPC,EAAmB,CAC9BlB,KACGmB,IAC0B,mBAAVnB,EAAwBA,KAAuCmB,GAAQnB,ECV/EoB,EAAUC,GAA4C,OAAVA,EAS5CC,EAAYD,GAAqD,iBAAVA,EASvDE,EAAYF,GAAqD,iBAAVA,EASvDG,EAAUH,GAAsD,kBAAVA,EAStDI,EAAYJ,GAAqD,iBAAVA,EASvDK,EAAiBL,GAC5BI,EAASJ,KAAWD,EAAOC,IAAwC,IAA9BM,OAAOC,KAAKP,GAAOT,OAS7CiB,EAAWR,GAAuCS,MAAMD,QAAQR,GAShEU,EAAgBV,GAAgCQ,EAAQR,IAA2B,IAAjBA,EAAMT,OASxEoB,EAAcX,GAAoC,mBAAVA,EAWxCY,EAA0BZ,GACrCW,EAAYX,GAAsBa,MASvBC,EAASd,GACpBA,QAcWe,EAAsBf,GACvB,KAAVA,GAAgBc,EAAMd,GASXgB,EAAUhB,GAAkCA,aAAiBiB,KAS7DC,EAAelB,GAC1BgB,EAAOhB,KAAWmB,MAAMnB,EAAMoB,WASnBC,EAAYrB,GAAoCA,aAAiBsB,OASjEC,EAASvB,GAAmDA,aAAiBwB,IAS7EC,EAASzB,GAA0CA,aAAiB0B,IASpEC,EAAY3B,GAAqD,iBAAVA,EASvD4B,EAAe5B,QAAiD6B,IAAV7B,EAStD8B,EAAkB9B,GAC7BE,EAASF,IAAU+B,SAAS/B,GASjBgC,EAAahC,GACxBE,EAASF,IAAUiC,OAAOD,UAAUhC,GC/LzBkC,EAA6B,CACxCC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAASF,EAAOF,EAChBK,EAASF,EAAOF,EAEtB,OAAOK,KAAKC,KAAKH,GAAU,EAAIC,GAAU,IAW9BG,EAAuB,CAACC,EAAeC,IAClDJ,KAAKK,IAAIF,EAAQC,GAUNE,EAAsB,CAAC/C,EAAegD,IACzChD,EAAQgD,EAAc,IC9BnBC,EAA2BC,IACtC,MAGMC,EAHiBC,OAAOC,iBAAiBH,GACTI,iBAAiB,aAEzBC,MAAM,oBACpC,IAAKJ,EACH,MAAO,CACLK,WAAY,EACZC,WAAY,GAIhB,MAAMC,EAAkBP,EAAO,GAAGlE,MAAM,MAKxC,MAAO,CACLuE,WAJiBG,WAAWD,EAAgB,IAK5CD,WAJiBE,WAAWD,EAAgB,MCpBzC,SAASE,EAAOC,EAAgBC,GACrC,IAAKD,EACH,MAAM,IAAIE,MAAMD,EAEpB,Q","sources":["webpack://@react-hive/honey-utils/./src/string.ts","webpack://@react-hive/honey-utils/./src/array.ts","webpack://@react-hive/honey-utils/./src/function.ts","webpack://@react-hive/honey-utils/./src/guards.ts","webpack://@react-hive/honey-utils/./src/math.ts","webpack://@react-hive/honey-utils/./src/dom.ts","webpack://@react-hive/honey-utils/./src/index.ts"],"sourcesContent":["export const toKebabCase = (input: string): string =>\n input.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\nexport const camelToDashCase = (input: string): string =>\n input.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n/**\n * Splits a string into an array of filtered from redundant spaces words.\n *\n * @param input - The input string to be split.\n *\n * @returns An array of words from the input string.\n */\nexport const splitStringIntoWords = (input: string): string[] => input.split(' ').filter(Boolean);\n\n/**\n * Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.\n *\n * This function uses a variation of the DJB2 algorithm, which is a simple yet effective hashing algorithm\n * based on bitwise XOR (`^`) and multiplication by 33. It produces a non-negative 32-bit integer,\n * which is then converted to a base-36 string (digits + lowercase letters) to produce a compact output.\n *\n * Useful for:\n * - Generating stable class names in CSS-in-JS libraries.\n * - Producing consistent cache keys.\n * - Quick and lightweight hashing needs where cryptographic security is not required.\n *\n * โš ๏ธ This is not cryptographically secure and should not be used for hashing passwords or sensitive data.\n *\n * @param input - The input string to hash.\n *\n * @returns A short, base-36 encoded hash string.\n *\n * @example\n * ```ts\n * const className = hashString('background-color: red;');\n * // โ†’ 'e4k1z0x'\n * ```\n */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n\n for (let i = 0; i < input.length; i++) {\n hash = (hash * 33) ^ input.charCodeAt(i);\n }\n\n return (hash >>> 0).toString(36);\n};\n","/**\n * Filters out `null`, `undefined`, and other falsy values from an array,\n * returning a typed array of only truthy `Item` values.\n *\n * Useful when working with optional or nullable items that need to be sanitized.\n *\n * @template T - The type of the items in the array.\n *\n * @param array - An array of items that may include `null`, `undefined`, or falsy values.\n *\n * @returns A new array containing only truthy `Item` values.\n */\nexport const boolFilter = <T>(array: (T | false | null | undefined)[]): T[] =>\n array.filter(Boolean) as T[];\n","export const noop = () => {};\n\n/**\n * Invokes the given input if it is a function, passing the provided arguments.\n * Otherwise, returns the input as-is.\n *\n * @template Args - Tuple of argument types to pass to the function.\n * @template Result - Return type of the function or the value.\n *\n * @param input - A function to invoke with `args`, or a direct value of type `Result`.\n * @param args - Arguments to pass if `input` is a function.\n *\n * @returns The result of invoking the function, or the original value if it's not a function.\n */\nexport const invokeIfFunction = <Args extends any[], Result>(\n input: ((...args: Args) => Result) | Result,\n ...args: Args\n): Result => (typeof input === 'function' ? (input as (...args: Args) => Result)(...args) : input);\n","/**\n * Checks if a value is null.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is null; otherwise, `false`.\n */\nexport const isNull = (value: unknown): value is null => value === null;\n\n/**\n * Checks if a value is a string.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a string; otherwise, `false`.\n */\nexport const isString = (value: unknown): value is string => typeof value === 'string';\n\n/**\n * Checks if a value is a number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a number; otherwise, `false`.\n */\nexport const isNumber = (value: unknown): value is number => typeof value === 'number';\n\n/**\n * Checks if a value is a boolean.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a boolean; otherwise, `false`.\n */\nexport const isBool = (value: unknown): value is boolean => typeof value === 'boolean';\n\n/**\n * Checks if a value is an object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an object; otherwise, `false`.\n */\nexport const isObject = (value: unknown): value is object => typeof value === 'object';\n\n/**\n * Checks if a value is an empty object (no own enumerable properties).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty object; otherwise, `false`.\n */\nexport const isEmptyObject = (value: unknown): value is Record<string, never> =>\n isObject(value) && !isNull(value) && Object.keys(value).length === 0;\n\n/**\n * Checks if a value is an array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an array; otherwise, `false`.\n */\nexport const isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n\n/**\n * Checks if a value is an empty array.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an empty array; otherwise, `false`.\n */\nexport const isEmptyArray = (value: unknown): value is [] => isArray(value) && value.length === 0;\n\n/**\n * Checks if a value is a function.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a function; otherwise, `false`.\n */\nexport const isFunction = (value: unknown) => typeof value === 'function';\n\n/**\n * Checks if a value is a Promise.\n *\n * @template T - The type of the value that the Promise resolves to.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Promise; otherwise, `false`.\n */\nexport const isPromise = <T = unknown>(value: unknown): value is Promise<T> =>\n isFunction((value as Promise<T>)?.then);\n\n/**\n * Checks if a value is null or undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is `null` or `undefined`, otherwise `false`.\n */\nexport const isNil = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\n/**\n * Checks whether the provided value is considered \"empty\".\n *\n * A value is considered empty if it is:\n * - `null`\n * - `undefined`\n * - `''`\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is empty; otherwise, `false`.\n */\nexport const isNilOrEmptyString = (value: unknown): value is null | undefined =>\n value === '' || isNil(value);\n\n/**\n * Checks if a value is a Date object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Date object; otherwise, `false`.\n */\nexport const isDate = (value: unknown): value is Date => value instanceof Date;\n\n/**\n * Checks if a value is a valid Date object (not Invalid Date).\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a valid Date object; otherwise, `false`.\n */\nexport const isValidDate = (value: unknown): value is Date =>\n isDate(value) && !isNaN(value.getTime());\n\n/**\n * Checks if a value is a RegExp object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a RegExp object; otherwise, `false`.\n */\nexport const isRegExp = (value: unknown): value is RegExp => value instanceof RegExp;\n\n/**\n * Checks if a value is a Map.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Map; otherwise, `false`.\n */\nexport const isMap = (value: unknown): value is Map<unknown, unknown> => value instanceof Map;\n\n/**\n * Checks if a value is a Set.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Set; otherwise, `false`.\n */\nexport const isSet = (value: unknown): value is Set<unknown> => value instanceof Set;\n\n/**\n * Checks if a value is a Symbol.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a Symbol; otherwise, `false`.\n */\nexport const isSymbol = (value: unknown): value is symbol => typeof value === 'symbol';\n\n/**\n * Checks if a value is undefined.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is undefined; otherwise, `false`.\n */\nexport const isUndefined = (value: unknown): value is undefined => value === undefined;\n\n/**\n * Checks if a value is a finite number.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is a finite number; otherwise, `false`.\n */\nexport const isFiniteNumber = (value: unknown): value is number =>\n isNumber(value) && isFinite(value);\n\n/**\n * Checks if a value is an integer.\n *\n * @param value - The value to check.\n *\n * @returns `true` if the value is an integer; otherwise, `false`.\n */\nexport const isInteger = (value: unknown): value is number =>\n isNumber(value) && Number.isInteger(value);\n","/**\n * Calculates the Euclidean distance between two points in 2D space.\n *\n * @param startX - The X coordinate of the starting point.\n * @param startY - The Y coordinate of the starting point.\n * @param endX - The X coordinate of the ending point.\n * @param endY - The Y coordinate of the ending point.\n *\n * @returns The Euclidean distance between the two points.\n */\nexport const calculateEuclideanDistance = (\n startX: number,\n startY: number,\n endX: number,\n endY: number,\n): number => {\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n};\n\n/**\n * Calculates the moving speed.\n *\n * @param delta - The change in position (distance).\n * @param elapsedTime - The time taken to move the distance.\n *\n * @returns The calculated speed, which is the absolute value of delta divided by elapsed time.\n */\nexport const calculateMovingSpeed = (delta: number, elapsedTime: number): number =>\n Math.abs(delta / elapsedTime);\n\n/**\n * Calculates the specified percentage of a given value.\n *\n * @param value - The value to calculate the percentage of.\n * @param percentage - The percentage to calculate.\n *\n * @returns The calculated percentage of the value.\n */\nexport const calculatePercentage = (value: number, percentage: number): number => {\n return (value * percentage) / 100;\n};\n","interface HTMLElementTransformationValues {\n translateX: number;\n translateY: number;\n}\n\n/**\n * Get various transformation values from the transformation matrix of an element.\n *\n * @param element - The element with a transformation applied.\n *\n * @returns An object containing transformation values.\n */\nexport const getTransformationValues = (element: HTMLElement): HTMLElementTransformationValues => {\n const computedStyles = window.getComputedStyle(element);\n const transformValue = computedStyles.getPropertyValue('transform');\n\n const matrix = transformValue.match(/^matrix\\((.+)\\)$/);\n if (!matrix) {\n return {\n translateX: 0,\n translateY: 0,\n };\n }\n\n const transformMatrix = matrix[1].split(', ');\n\n const translateX = parseFloat(transformMatrix[4]);\n const translateY = parseFloat(transformMatrix[5]);\n\n return {\n translateX,\n translateY,\n };\n};\n","export * from './string';\nexport * from './array';\nexport * from './function';\nexport * from './guards';\nexport * from './math';\nexport * from './dom';\n\nexport function assert(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"names":["toKebabCase","input","replace","toLowerCase","camelToDashCase","letter","splitStringIntoWords","split","filter","Boolean","hashString","hash","i","length","charCodeAt","toString","boolFilter","array","noop","invokeIfFunction","args","isNull","value","isString","isNumber","isBool","isObject","isEmptyObject","Object","keys","isArray","Array","isEmptyArray","isFunction","isPromise","then","isNil","isNilOrEmptyString","isDate","Date","isValidDate","isNaN","getTime","isRegExp","RegExp","isMap","Map","isSet","Set","isSymbol","isUndefined","undefined","isFiniteNumber","isFinite","isInteger","Number","calculateEuclideanDistance","startX","startY","endX","endY","deltaX","deltaY","Math","sqrt","calculateMovingSpeed","delta","elapsedTime","abs","calculatePercentage","percentage","getTransformationValues","element","matrix","window","getComputedStyle","getPropertyValue","match","translateX","translateY","transformMatrix","parseFloat","assert","condition","message","Error"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@react-hive/honey-utils",
3
- "version": "1.2.0",
4
- "description": "",
3
+ "version": "1.3.0",
4
+ "description": "A lightweight TypeScript utility library providing a collection of helper functions for common programming tasks",
5
5
  "keywords": [
6
6
  "utils",
7
- "typescript"
7
+ "typescript",
8
+ "type-guards",
9
+ "string-utils",
10
+ "array-utils",
11
+ "math-utils",
12
+ "function-utils",
13
+ "dom-utils",
14
+ "helpers",
15
+ "utility-functions"
8
16
  ],
9
17
  "homepage": "https://github.com/React-Hive/honey-utils",
10
18
  "bugs": {