nhb-toolbox 2.0.7 → 2.1.2
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/dist/array/basics.d.ts +8 -7
- package/dist/array/basics.d.ts.map +1 -1
- package/dist/array/basics.js +19 -15
- package/dist/array/transform.d.ts.map +1 -1
- package/dist/array/types.d.ts +3 -2
- package/dist/array/types.d.ts.map +1 -1
- package/dist/form/convert.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/index.js +1 -1
- package/package.json +2 -2
package/dist/array/basics.d.ts
CHANGED
|
@@ -13,18 +13,19 @@ export declare const flattenArray: <T>(input: T | T[]) => Flattened<T>[];
|
|
|
13
13
|
*
|
|
14
14
|
* @template T - The type of objects in the array.
|
|
15
15
|
* @param array - The array of objects to filter.
|
|
16
|
-
* @param conditions - An object where keys represent the property names and values represent
|
|
17
|
-
* The conditions can be a value
|
|
16
|
+
* @param conditions - An object where keys represent the property names and values represent filter conditions.
|
|
17
|
+
* The conditions can be a function `(value: T[K]) => boolean`.
|
|
18
18
|
* @returns The filtered array of objects.
|
|
19
|
+
* @throws {Error} If the input is not a valid array.
|
|
19
20
|
*/
|
|
20
|
-
export declare const filterArrayOfObjects: <T extends GenericObject>(array: T[], conditions: { [K in keyof T]?: (value: T[K]) => boolean; }) => T[];
|
|
21
|
+
export declare const filterArrayOfObjects: <T extends GenericObject>(array: T[], conditions: { [K in keyof T]?: (value: T[K] | undefined) => boolean; }) => T[];
|
|
21
22
|
/**
|
|
22
|
-
* *
|
|
23
|
+
* * Checks if a value is an empty array or an array with only empty values.
|
|
23
24
|
*
|
|
24
|
-
* @param
|
|
25
|
-
* @returns
|
|
25
|
+
* @param value - The value to check.
|
|
26
|
+
* @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
|
|
26
27
|
*/
|
|
27
|
-
export declare const
|
|
28
|
+
export declare const isValidEmptyArray: <T>(value: T | T[]) => boolean;
|
|
28
29
|
/**
|
|
29
30
|
* * Shuffle the elements of an array.
|
|
30
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basics.d.ts","sourceRoot":"","sources":["../../src/array/basics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAG,SAAS,CAAC,CAAC,CAAC,EAO5D,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"basics.d.ts","sourceRoot":"","sources":["../../src/array/basics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAG,SAAS,CAAC,CAAC,CAAC,EAO5D,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,aAAa,SACpD,CAAC,EAAE,cACE,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,OAAO,GAAE,KACnE,CAAC,EAeH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAG,OAWrD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,EAAE,KAAG,CAAC,EAW7C,CAAC"}
|
package/dist/array/basics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shuffleArray = exports.
|
|
3
|
+
exports.shuffleArray = exports.isValidEmptyArray = exports.filterArrayOfObjects = exports.flattenArray = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* * Flattens a nested array recursively or wraps any non-array data type in an array.
|
|
6
6
|
*
|
|
@@ -22,35 +22,39 @@ exports.flattenArray = flattenArray;
|
|
|
22
22
|
*
|
|
23
23
|
* @template T - The type of objects in the array.
|
|
24
24
|
* @param array - The array of objects to filter.
|
|
25
|
-
* @param conditions - An object where keys represent the property names and values represent
|
|
26
|
-
* The conditions can be a value
|
|
25
|
+
* @param conditions - An object where keys represent the property names and values represent filter conditions.
|
|
26
|
+
* The conditions can be a function `(value: T[K]) => boolean`.
|
|
27
27
|
* @returns The filtered array of objects.
|
|
28
|
+
* @throws {Error} If the input is not a valid array.
|
|
28
29
|
*/
|
|
29
30
|
const filterArrayOfObjects = (array, conditions) => {
|
|
30
31
|
if (!Array.isArray(array)) {
|
|
31
|
-
throw new Error('The provided input is not
|
|
32
|
+
throw new Error('The provided input is not a valid array!');
|
|
32
33
|
}
|
|
33
34
|
return array.filter((item) => Object.entries(conditions).every(([key, conditionFn]) => {
|
|
34
|
-
|
|
35
|
-
if (conditionFn) {
|
|
36
|
-
// Type assertion for the value since it's unknown
|
|
35
|
+
if (typeof conditionFn === 'function') {
|
|
37
36
|
return conditionFn(item[key]);
|
|
38
37
|
}
|
|
39
|
-
// If no condition function, include all values for the key
|
|
40
38
|
return true;
|
|
41
39
|
}));
|
|
42
40
|
};
|
|
43
41
|
exports.filterArrayOfObjects = filterArrayOfObjects;
|
|
44
42
|
/**
|
|
45
|
-
* *
|
|
43
|
+
* * Checks if a value is an empty array or an array with only empty values.
|
|
46
44
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
45
|
+
* @param value - The value to check.
|
|
46
|
+
* @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
|
|
49
47
|
*/
|
|
50
|
-
const
|
|
51
|
-
|
|
48
|
+
const isValidEmptyArray = (value) => {
|
|
49
|
+
if (!Array.isArray(value))
|
|
50
|
+
return true;
|
|
51
|
+
if (value.length === 0)
|
|
52
|
+
return true;
|
|
53
|
+
return value.every((item) => item == null || // null or undefined
|
|
54
|
+
(Array.isArray(item) && item.length === 0) || // Empty array
|
|
55
|
+
(typeof item === 'object' && Object.keys(item || {}).length === 0));
|
|
52
56
|
};
|
|
53
|
-
exports.
|
|
57
|
+
exports.isValidEmptyArray = isValidEmptyArray;
|
|
54
58
|
/**
|
|
55
59
|
* * Shuffle the elements of an array.
|
|
56
60
|
*
|
|
@@ -58,7 +62,7 @@ exports.isValidButEmptyArray = isValidButEmptyArray;
|
|
|
58
62
|
* @returns Shuffled array.
|
|
59
63
|
*/
|
|
60
64
|
const shuffleArray = (array) => {
|
|
61
|
-
if ((0, exports.
|
|
65
|
+
if ((0, exports.isValidEmptyArray)(array))
|
|
62
66
|
return array;
|
|
63
67
|
const shuffled = structuredClone(array);
|
|
64
68
|
for (let i = shuffled.length - 1; i > 0; i--) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/array/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC9B,CAAC,SAAS,WAAW,EACrB,EAAE,SAAS,MAAM,YACjB,EAAE,SAAS,MAAM,kBAEX,CAAC,EAAE,UACD,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAC9B,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAE,
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/array/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC9B,CAAC,SAAS,WAAW,EACrB,EAAE,SAAS,MAAM,YACjB,EAAE,SAAS,MAAM,kBAEX,CAAC,EAAE,UACD,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAC9B,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAE,EAgB5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAK5D"}
|
package/dist/array/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Primitive } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* * Flatten Array or Wrap in Array
|
|
3
4
|
*
|
|
@@ -5,7 +6,7 @@
|
|
|
5
6
|
* */
|
|
6
7
|
export type Flattened<T> = T extends (infer U)[] ? Flattened<U> : T;
|
|
7
8
|
/** - Input for `createOptionsArray`. */
|
|
8
|
-
export type OptionInput = Record<string,
|
|
9
|
+
export type OptionInput = Record<string, Primitive>;
|
|
9
10
|
/**
|
|
10
11
|
* - Configuration for `createOptionsArray`.
|
|
11
12
|
* - Defines the mapping between keys in the input objects and the keys in the output options.
|
|
@@ -14,7 +15,7 @@ export type OptionInput = Record<string, string | number | null | undefined>;
|
|
|
14
15
|
* @typeParam K1 - The name of the key for the first field in the output (default: `'value'`).
|
|
15
16
|
* @typeParam K2 - The name of the key for the second field in the output (default: `'label'`).
|
|
16
17
|
*/
|
|
17
|
-
export interface OptionsConfig<T
|
|
18
|
+
export interface OptionsConfig<T, K1, K2> {
|
|
18
19
|
/**
|
|
19
20
|
* - The key in the input objects to use for the first field of the option.
|
|
20
21
|
* @example If the input objects have an `id` field and you want to use it as the `value` field in the output, set createOptionsArray(data, {firstFieldKey: 'id'}).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/array/types.ts"],"names":[],"mappings":"AAAA;;;;MAIM;AACN,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEpE,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/array/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;MAIM;AACN,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEpE,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE;IACvC;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC,CAAC;IAEvB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC,CAAC;IAExB;;;;OAIG;IACH,cAAc,CAAC,EAAE,EAAE,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC;CACrB;AAED,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEpE,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC7D,SAAQ,WAAW;IACnB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;CACtB"}
|
package/dist/form/convert.js
CHANGED
|
@@ -11,7 +11,7 @@ const basics_1 = require("../array/basics");
|
|
|
11
11
|
const convertIntoFormData = (data) => {
|
|
12
12
|
const formData = new FormData();
|
|
13
13
|
Object.entries(data).forEach(([key, value]) => {
|
|
14
|
-
if (!(0, basics_1.
|
|
14
|
+
if (!(0, basics_1.isValidEmptyArray)(value) && value[0]?.originFileObj) {
|
|
15
15
|
formData.append(key, value[0].originFileObj);
|
|
16
16
|
}
|
|
17
17
|
else if (value !== undefined && value !== null && value !== '') {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { getColorForInitial } from './colors/initials';
|
|
|
9
9
|
export { generateRandomColorInHexRGB, generateRandomHSLColor, } from './colors/random';
|
|
10
10
|
export { convertColorCode, convertHex8ToHsla, convertHex8ToRgba, convertHexToHsl, convertHexToRgb, convertHslaToHex8, convertHslaToRgba, convertHslToHex, convertHslToRgb, convertRgbaToHex8, convertRgbaToHsla, convertRgbToHex, convertRgbToHsl, convertRgbToRgba, } from './colors/convert';
|
|
11
11
|
export { Color } from './colors/Color';
|
|
12
|
-
export { filterArrayOfObjects, flattenArray,
|
|
12
|
+
export { filterArrayOfObjects, flattenArray, isValidEmptyArray, shuffleArray, } from './array/basics';
|
|
13
13
|
export { sortAnArray } from './array/sort';
|
|
14
14
|
export { createOptionsArray, removeDuplicatesFromArray, } from './array/transform';
|
|
15
15
|
export { convertIntoFormData, isEmptyFormData } from './form/convert';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,cAAc,G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ED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flattenObjectKeyValue = exports.flattenObjectDotNotation = exports.extractUpdatedFields = exports.extractUpdatedAndNewFields = exports.extractNewFields = exports.isObject = exports.isEmptyObject = exports.generateQueryParams = exports.countObjectFields = exports.cloneObject = exports.createControlledFormData = exports.isEmptyFormData = exports.convertIntoFormData = exports.removeDuplicatesFromArray = exports.createOptionsArray = exports.sortAnArray = exports.shuffleArray = exports.
|
|
3
|
+
exports.flattenObjectKeyValue = exports.flattenObjectDotNotation = exports.extractUpdatedFields = exports.extractUpdatedAndNewFields = exports.extractNewFields = exports.isObject = exports.isEmptyObject = exports.generateQueryParams = exports.countObjectFields = exports.cloneObject = exports.createControlledFormData = exports.isEmptyFormData = exports.convertIntoFormData = exports.removeDuplicatesFromArray = exports.createOptionsArray = exports.sortAnArray = exports.shuffleArray = exports.isValidEmptyArray = exports.flattenArray = exports.filterArrayOfObjects = exports.Color = exports.convertRgbToRgba = exports.convertRgbToHsl = exports.convertRgbToHex = exports.convertRgbaToHsla = exports.convertRgbaToHex8 = exports.convertHslToRgb = exports.convertHslToHex = exports.convertHslaToRgba = exports.convertHslaToHex8 = exports.convertHexToRgb = exports.convertHexToHsl = exports.convertHex8ToRgba = exports.convertHex8ToHsla = exports.convertColorCode = exports.generateRandomHSLColor = exports.generateRandomColorInHexRGB = exports.getColorForInitial = exports.getNumbersInRange = exports.isPrime = exports.findPrimeNumbers = exports.numberToWords = exports.getRandomNumber = exports.convertToDecimal = exports.convertStringCase = exports.generateAnagrams = exports.truncateString = exports.trimString = exports.generateRandomID = exports.capitalizeString = void 0;
|
|
4
4
|
exports.isDeepEqual = exports.convertArrayToString = exports.convertObjectValues = exports.sanitizeData = exports.mergeObjects = exports.mergeAndFlattenObjects = void 0;
|
|
5
5
|
var basics_1 = require("./string/basics");
|
|
6
6
|
Object.defineProperty(exports, "capitalizeString", { enumerable: true, get: function () { return basics_1.capitalizeString; } });
|
|
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "Color", { enumerable: true, get: function () { r
|
|
|
46
46
|
var basics_3 = require("./array/basics");
|
|
47
47
|
Object.defineProperty(exports, "filterArrayOfObjects", { enumerable: true, get: function () { return basics_3.filterArrayOfObjects; } });
|
|
48
48
|
Object.defineProperty(exports, "flattenArray", { enumerable: true, get: function () { return basics_3.flattenArray; } });
|
|
49
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "isValidEmptyArray", { enumerable: true, get: function () { return basics_3.isValidEmptyArray; } });
|
|
50
50
|
Object.defineProperty(exports, "shuffleArray", { enumerable: true, get: function () { return basics_3.shuffleArray; } });
|
|
51
51
|
var sort_1 = require("./array/sort");
|
|
52
52
|
Object.defineProperty(exports, "sortAnArray", { enumerable: true, get: function () { return sort_1.sortAnArray; } });
|
package/dist/utils/index.js
CHANGED
|
@@ -44,7 +44,7 @@ exports.isDeepEqual = isDeepEqual;
|
|
|
44
44
|
* @returns Converted array in string format with the separator.
|
|
45
45
|
*/
|
|
46
46
|
const convertArrayToString = (array, separator = ',') => {
|
|
47
|
-
if (!basics_1.
|
|
47
|
+
if (!basics_1.isValidEmptyArray) {
|
|
48
48
|
throw new Error('Please, provide a valid array!');
|
|
49
49
|
}
|
|
50
50
|
return array.join(separator);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions for everyday development needs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"clean": "rimraf dist",
|
|
56
56
|
"build": "node build.mjs",
|
|
57
|
-
"test": "jest --coverage",
|
|
57
|
+
"test": "jest --coverage --verbose",
|
|
58
58
|
"format": "prettier --write src/",
|
|
59
59
|
"lint": "node lint.mjs",
|
|
60
60
|
"fix": "node fix.mjs"
|