nhb-toolbox 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/form/convert.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -22
- package/dist/object/basics.d.ts +3 -1
- package/dist/object/basics.d.ts.map +1 -1
- package/dist/object/basics.js +10 -4
- package/dist/object/objectify.d.ts +8 -1
- package/dist/object/objectify.d.ts.map +1 -1
- package/dist/object/objectify.js +31 -4
- package/dist/object/types.d.ts +13 -2
- package/dist/object/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- 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--) {
|
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,13 +9,13 @@ 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';
|
|
16
16
|
export { createControlledFormData } from './form/transform';
|
|
17
17
|
export { cloneObject, countObjectFields, generateQueryParams, isEmptyObject, isObject, } from './object/basics';
|
|
18
|
-
export { extractNewFields, extractUpdatedAndNewFields, extractUpdatedFields,
|
|
18
|
+
export { extractNewFields, extractUpdatedAndNewFields, extractUpdatedFields, flattenObjectDotNotation, flattenObjectKeyValue, mergeAndFlattenObjects, mergeObjects, } from './object/objectify';
|
|
19
19
|
export { sanitizeData } from './object/sanitize';
|
|
20
20
|
export { convertObjectValues } from './object/convert';
|
|
21
21
|
export { convertArrayToString, isDeepEqual } from './utils';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,iB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oB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isDeepEqual = exports.convertArrayToString = exports.convertObjectValues = exports.sanitizeData = exports.mergeObjects = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
Object.defineProperty(exports, "
|
|
9
|
-
Object.defineProperty(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
|
+
exports.isDeepEqual = exports.convertArrayToString = exports.convertObjectValues = exports.sanitizeData = exports.mergeObjects = exports.mergeAndFlattenObjects = void 0;
|
|
5
|
+
const basics_1 = require("./array/basics");
|
|
6
|
+
var basics_2 = require("./string/basics");
|
|
7
|
+
Object.defineProperty(exports, "capitalizeString", { enumerable: true, get: function () { return basics_2.capitalizeString; } });
|
|
8
|
+
Object.defineProperty(exports, "generateRandomID", { enumerable: true, get: function () { return basics_2.generateRandomID; } });
|
|
9
|
+
Object.defineProperty(exports, "trimString", { enumerable: true, get: function () { return basics_2.trimString; } });
|
|
10
|
+
Object.defineProperty(exports, "truncateString", { enumerable: true, get: function () { return basics_2.truncateString; } });
|
|
10
11
|
var anagram_1 = require("./string/anagram");
|
|
11
12
|
Object.defineProperty(exports, "generateAnagrams", { enumerable: true, get: function () { return anagram_1.generateAnagrams; } });
|
|
12
13
|
var convert_1 = require("./string/convert");
|
|
13
14
|
Object.defineProperty(exports, "convertStringCase", { enumerable: true, get: function () { return convert_1.convertStringCase; } });
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "convertToDecimal", { enumerable: true, get: function () { return
|
|
16
|
-
Object.defineProperty(exports, "getRandomNumber", { enumerable: true, get: function () { return
|
|
15
|
+
var basics_3 = require("./number/basics");
|
|
16
|
+
Object.defineProperty(exports, "convertToDecimal", { enumerable: true, get: function () { return basics_3.convertToDecimal; } });
|
|
17
|
+
Object.defineProperty(exports, "getRandomNumber", { enumerable: true, get: function () { return basics_3.getRandomNumber; } });
|
|
17
18
|
var convert_2 = require("./number/convert");
|
|
18
19
|
Object.defineProperty(exports, "numberToWords", { enumerable: true, get: function () { return convert_2.numberToWords; } });
|
|
19
20
|
var prime_1 = require("./number/prime");
|
|
@@ -43,11 +44,11 @@ Object.defineProperty(exports, "convertRgbToHsl", { enumerable: true, get: funct
|
|
|
43
44
|
Object.defineProperty(exports, "convertRgbToRgba", { enumerable: true, get: function () { return convert_3.convertRgbToRgba; } });
|
|
44
45
|
var Color_1 = require("./colors/Color");
|
|
45
46
|
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return Color_1.Color; } });
|
|
46
|
-
var
|
|
47
|
-
Object.defineProperty(exports, "filterArrayOfObjects", { enumerable: true, get: function () { return
|
|
48
|
-
Object.defineProperty(exports, "flattenArray", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
Object.defineProperty(exports, "shuffleArray", { enumerable: true, get: function () { return
|
|
47
|
+
var basics_4 = require("./array/basics");
|
|
48
|
+
Object.defineProperty(exports, "filterArrayOfObjects", { enumerable: true, get: function () { return basics_4.filterArrayOfObjects; } });
|
|
49
|
+
Object.defineProperty(exports, "flattenArray", { enumerable: true, get: function () { return basics_4.flattenArray; } });
|
|
50
|
+
Object.defineProperty(exports, "isValidEmptyArray", { enumerable: true, get: function () { return basics_4.isValidEmptyArray; } });
|
|
51
|
+
Object.defineProperty(exports, "shuffleArray", { enumerable: true, get: function () { return basics_4.shuffleArray; } });
|
|
51
52
|
var sort_1 = require("./array/sort");
|
|
52
53
|
Object.defineProperty(exports, "sortAnArray", { enumerable: true, get: function () { return sort_1.sortAnArray; } });
|
|
53
54
|
var transform_1 = require("./array/transform");
|
|
@@ -58,17 +59,18 @@ Object.defineProperty(exports, "convertIntoFormData", { enumerable: true, get: f
|
|
|
58
59
|
Object.defineProperty(exports, "isEmptyFormData", { enumerable: true, get: function () { return convert_4.isEmptyFormData; } });
|
|
59
60
|
var transform_2 = require("./form/transform");
|
|
60
61
|
Object.defineProperty(exports, "createControlledFormData", { enumerable: true, get: function () { return transform_2.createControlledFormData; } });
|
|
61
|
-
var
|
|
62
|
-
Object.defineProperty(exports, "cloneObject", { enumerable: true, get: function () { return
|
|
63
|
-
Object.defineProperty(exports, "countObjectFields", { enumerable: true, get: function () { return
|
|
64
|
-
Object.defineProperty(exports, "generateQueryParams", { enumerable: true, get: function () { return
|
|
65
|
-
Object.defineProperty(exports, "isEmptyObject", { enumerable: true, get: function () { return
|
|
66
|
-
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return
|
|
62
|
+
var basics_5 = require("./object/basics");
|
|
63
|
+
Object.defineProperty(exports, "cloneObject", { enumerable: true, get: function () { return basics_5.cloneObject; } });
|
|
64
|
+
Object.defineProperty(exports, "countObjectFields", { enumerable: true, get: function () { return basics_5.countObjectFields; } });
|
|
65
|
+
Object.defineProperty(exports, "generateQueryParams", { enumerable: true, get: function () { return basics_5.generateQueryParams; } });
|
|
66
|
+
Object.defineProperty(exports, "isEmptyObject", { enumerable: true, get: function () { return basics_5.isEmptyObject; } });
|
|
67
|
+
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return basics_5.isObject; } });
|
|
67
68
|
var objectify_1 = require("./object/objectify");
|
|
68
69
|
Object.defineProperty(exports, "extractNewFields", { enumerable: true, get: function () { return objectify_1.extractNewFields; } });
|
|
69
70
|
Object.defineProperty(exports, "extractUpdatedAndNewFields", { enumerable: true, get: function () { return objectify_1.extractUpdatedAndNewFields; } });
|
|
70
71
|
Object.defineProperty(exports, "extractUpdatedFields", { enumerable: true, get: function () { return objectify_1.extractUpdatedFields; } });
|
|
71
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "flattenObjectDotNotation", { enumerable: true, get: function () { return objectify_1.flattenObjectDotNotation; } });
|
|
73
|
+
Object.defineProperty(exports, "flattenObjectKeyValue", { enumerable: true, get: function () { return objectify_1.flattenObjectKeyValue; } });
|
|
72
74
|
Object.defineProperty(exports, "mergeAndFlattenObjects", { enumerable: true, get: function () { return objectify_1.mergeAndFlattenObjects; } });
|
|
73
75
|
Object.defineProperty(exports, "mergeObjects", { enumerable: true, get: function () { return objectify_1.mergeObjects; } });
|
|
74
76
|
var sanitize_1 = require("./object/sanitize");
|
|
@@ -78,3 +80,4 @@ Object.defineProperty(exports, "convertObjectValues", { enumerable: true, get: f
|
|
|
78
80
|
var utils_1 = require("./utils");
|
|
79
81
|
Object.defineProperty(exports, "convertArrayToString", { enumerable: true, get: function () { return utils_1.convertArrayToString; } });
|
|
80
82
|
Object.defineProperty(exports, "isDeepEqual", { enumerable: true, get: function () { return utils_1.isDeepEqual; } });
|
|
83
|
+
(0, basics_1.isValidEmptyArray)(null);
|
package/dist/object/basics.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GenericObject, QueryObject } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* * Utility to generate query parameters from an object.
|
|
4
4
|
*
|
|
5
|
-
* @template T - A generic type extending `
|
|
5
|
+
* @template T - A generic type extending `QueryObject`.
|
|
6
6
|
* @param params - Object containing query parameters.
|
|
7
7
|
* @returns A query string as a URL-encoded string, e.g., `?key1=value1&key2=value2`.
|
|
8
8
|
*
|
|
@@ -10,6 +10,8 @@ import type { GenericObject, QueryObject } from './types';
|
|
|
10
10
|
* generateQueryParams({ key1: 'value1', key2: 42 }); // "?key1=value1&key2=42"
|
|
11
11
|
* generateQueryParams({ key1: ['value1', 'value2'], key2: 42 }); // "?key1=value1&key1=value2&key2=42"
|
|
12
12
|
* generateQueryParams({ key1: '', key2: null }); // ""
|
|
13
|
+
* generateQueryParams({ key1: true, key2: false }); // "?key1=true&key2=false"
|
|
14
|
+
* generateQueryParams({ filters: { category: 'laptop', price: 1000 } }); // "?category=laptop&price=1000"
|
|
13
15
|
*/
|
|
14
16
|
export declare const generateQueryParams: <T extends QueryObject>(params?: T) => string;
|
|
15
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basics.d.ts","sourceRoot":"","sources":["../../src/object/basics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basics.d.ts","sourceRoot":"","sources":["../../src/object/basics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,WAAW,WAChD,CAAC,KACP,MAkCF,CAAC;AACF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,aAAa,OAAO,CAAC,KAAG,CAE7D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,aAAa,OAAO,CAAC,KAAG,OAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,aAAa,OAAO,CAAC,KAAG,MAEnE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,SAAU,OAAO,KAAG,OAExC,CAAC"}
|
package/dist/object/basics.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isObject = exports.countObjectFields = exports.isEmptyObject = exports.cloneObject = exports.generateQueryParams = void 0;
|
|
4
|
+
const objectify_1 = require("./objectify");
|
|
4
5
|
/**
|
|
5
6
|
* * Utility to generate query parameters from an object.
|
|
6
7
|
*
|
|
7
|
-
* @template T - A generic type extending `
|
|
8
|
+
* @template T - A generic type extending `QueryObject`.
|
|
8
9
|
* @param params - Object containing query parameters.
|
|
9
10
|
* @returns A query string as a URL-encoded string, e.g., `?key1=value1&key2=value2`.
|
|
10
11
|
*
|
|
@@ -12,9 +13,14 @@ exports.isObject = exports.countObjectFields = exports.isEmptyObject = exports.c
|
|
|
12
13
|
* generateQueryParams({ key1: 'value1', key2: 42 }); // "?key1=value1&key2=42"
|
|
13
14
|
* generateQueryParams({ key1: ['value1', 'value2'], key2: 42 }); // "?key1=value1&key1=value2&key2=42"
|
|
14
15
|
* generateQueryParams({ key1: '', key2: null }); // ""
|
|
16
|
+
* generateQueryParams({ key1: true, key2: false }); // "?key1=true&key2=false"
|
|
17
|
+
* generateQueryParams({ filters: { category: 'laptop', price: 1000 } }); // "?category=laptop&price=1000"
|
|
15
18
|
*/
|
|
16
19
|
const generateQueryParams = (params = {}) => {
|
|
17
|
-
|
|
20
|
+
// Flatten the nested object into key-value pairs
|
|
21
|
+
const flattenedParams = (0, objectify_1.flattenObjectKeyValue)(params);
|
|
22
|
+
// Generate the query string
|
|
23
|
+
const queryParams = Object.entries(flattenedParams)
|
|
18
24
|
.filter(([_, value]) => value !== undefined &&
|
|
19
25
|
value !== null &&
|
|
20
26
|
!(typeof value === 'string' && value.trim() === ''))
|
|
@@ -23,8 +29,8 @@ const generateQueryParams = (params = {}) => {
|
|
|
23
29
|
.filter((v) => v !== undefined &&
|
|
24
30
|
v !== null &&
|
|
25
31
|
!(typeof v === 'string' && v.trim() === ''))
|
|
26
|
-
.map((v) => `${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`)
|
|
27
|
-
: `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
|
|
32
|
+
.map((v) => `${encodeURIComponent(key)}=${encodeURIComponent(typeof v === 'boolean' ? String(v) : String(v))}`)
|
|
33
|
+
: `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === 'boolean' ? String(value) : String(value))}`)
|
|
28
34
|
.join('&');
|
|
29
35
|
return queryParams ? `?${queryParams}` : '';
|
|
30
36
|
};
|
|
@@ -15,13 +15,20 @@ export declare const mergeObjects: <T extends GenericObject>(...objects: T[]) =>
|
|
|
15
15
|
* @returns Merged object with flattened structure.
|
|
16
16
|
*/
|
|
17
17
|
export declare const mergeAndFlattenObjects: <T extends GenericObject>(...objects: T[]) => GenericObject;
|
|
18
|
+
/**
|
|
19
|
+
* * Flattens a nested object into key-value format.
|
|
20
|
+
*
|
|
21
|
+
* @param object - The `object` to flatten.
|
|
22
|
+
* @returns A `flattened object` in key-value format.
|
|
23
|
+
*/
|
|
24
|
+
export declare const flattenObjectKeyValue: <T extends LooseObject>(object: T) => T;
|
|
18
25
|
/**
|
|
19
26
|
* * Flattens a nested object into a dot notation format.
|
|
20
27
|
*
|
|
21
28
|
* @param object - The `object` to flatten.
|
|
22
29
|
* @returns A `flattened object` with dot notation keys.
|
|
23
30
|
*/
|
|
24
|
-
export declare const
|
|
31
|
+
export declare const flattenObjectDotNotation: <T extends GenericObject>(object: T) => GenericObject;
|
|
25
32
|
/**
|
|
26
33
|
* * Extracts only the fields that have changed between the original and updated object.
|
|
27
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectify.d.ts","sourceRoot":"","sources":["../../src/object/objectify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,aAAa,cAAc,CAAC,EAAE,KAAG,CAuCvE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,aAAa,cACjD,CAAC,EAAE,KACb,aAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"objectify.d.ts","sourceRoot":"","sources":["../../src/object/objectify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,aAAa,cAAc,CAAC,EAAE,KAAG,CAuCvE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,aAAa,cACjD,CAAC,EAAE,KACb,aAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,WAAW,UAAU,CAAC,KAAG,CAmBxE,CAAC;AACF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,aAAa,UACvD,CAAC,KACP,aAkCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,WAAW,cAC7C,CAAC,iBACE,OAAO,CAAC,CAAC,CAAC,KACvB,OAAO,CAAC,CAAC,CAwBX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW,cACzC,CAAC,iBACE,OAAO,CAAC,CAAC,CAAC,KACvB,OAAO,CAAC,CAAC,CAqBX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,WAAW,cACnD,CAAC,iBACE,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,KACrC,OAAO,CAAC,CAAC,CAAC,GAAG,WAwBf,CAAC"}
|
package/dist/object/objectify.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractUpdatedAndNewFields = exports.extractNewFields = exports.extractUpdatedFields = exports.
|
|
3
|
+
exports.extractUpdatedAndNewFields = exports.extractNewFields = exports.extractUpdatedFields = exports.flattenObjectDotNotation = exports.flattenObjectKeyValue = exports.mergeAndFlattenObjects = exports.mergeObjects = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const basics_1 = require("./basics");
|
|
6
6
|
/**
|
|
@@ -70,13 +70,37 @@ const mergeAndFlattenObjects = (...objects) => {
|
|
|
70
70
|
return result;
|
|
71
71
|
};
|
|
72
72
|
exports.mergeAndFlattenObjects = mergeAndFlattenObjects;
|
|
73
|
+
/**
|
|
74
|
+
* * Flattens a nested object into key-value format.
|
|
75
|
+
*
|
|
76
|
+
* @param object - The `object` to flatten.
|
|
77
|
+
* @returns A `flattened object` in key-value format.
|
|
78
|
+
*/
|
|
79
|
+
const flattenObjectKeyValue = (object) => {
|
|
80
|
+
const flattened = {};
|
|
81
|
+
for (const [key, value] of Object.entries(object)) {
|
|
82
|
+
if (typeof value === 'object' &&
|
|
83
|
+
value !== null &&
|
|
84
|
+
!Array.isArray(value)) {
|
|
85
|
+
// Recursively flatten nested objects
|
|
86
|
+
const nestedFlattened = (0, exports.flattenObjectKeyValue)(value);
|
|
87
|
+
Object.assign(flattened, nestedFlattened);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// Directly assign non-object values
|
|
91
|
+
flattened[key] = value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return flattened;
|
|
95
|
+
};
|
|
96
|
+
exports.flattenObjectKeyValue = flattenObjectKeyValue;
|
|
73
97
|
/**
|
|
74
98
|
* * Flattens a nested object into a dot notation format.
|
|
75
99
|
*
|
|
76
100
|
* @param object - The `object` to flatten.
|
|
77
101
|
* @returns A `flattened object` with dot notation keys.
|
|
78
102
|
*/
|
|
79
|
-
const
|
|
103
|
+
const flattenObjectDotNotation = (object) => {
|
|
80
104
|
/**
|
|
81
105
|
* * Recursively flattens an object, transforming nested structures into dot-notation keys.
|
|
82
106
|
*
|
|
@@ -89,7 +113,10 @@ const flattenObject = (object) => {
|
|
|
89
113
|
for (const [key, value] of Object.entries(source)) {
|
|
90
114
|
// Construct the dot-notation key
|
|
91
115
|
const newKey = prefix ? `${String(prefix)}.${key}` : key;
|
|
92
|
-
if (value &&
|
|
116
|
+
if (value &&
|
|
117
|
+
typeof value === 'object' &&
|
|
118
|
+
!Array.isArray(value) &&
|
|
119
|
+
value !== null) {
|
|
93
120
|
// Recursively process nested objects
|
|
94
121
|
Object.assign(flattened, _flattenObject(value, newKey));
|
|
95
122
|
}
|
|
@@ -103,7 +130,7 @@ const flattenObject = (object) => {
|
|
|
103
130
|
// Call the recursive function with an empty prefix initially
|
|
104
131
|
return _flattenObject(object);
|
|
105
132
|
};
|
|
106
|
-
exports.
|
|
133
|
+
exports.flattenObjectDotNotation = flattenObjectDotNotation;
|
|
107
134
|
/**
|
|
108
135
|
* * Extracts only the fields that have changed between the original and updated object.
|
|
109
136
|
*
|
package/dist/object/types.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import type { Primitive } from '../types';
|
|
1
2
|
/** - Generic object with `unknown` value */
|
|
2
3
|
export type GenericObject = Record<string, unknown>;
|
|
3
4
|
/** - Generic object but with `any` value */
|
|
4
5
|
export type LooseObject = Record<string, any>;
|
|
5
|
-
/**
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* * Represents a value that can be used in a query object.
|
|
8
|
+
* - Can be a primitive, an array of primitives, or a nested query object.
|
|
9
|
+
*/
|
|
10
|
+
export type QueryObjectValue = Primitive | Primitive[] | QueryObject;
|
|
11
|
+
/**
|
|
12
|
+
* * Represents a query object with string keys and `QueryObjectValue` values.
|
|
13
|
+
* - Supports nested objects and arrays.
|
|
14
|
+
*/
|
|
15
|
+
export type QueryObject = {
|
|
16
|
+
[key: string]: QueryObjectValue;
|
|
17
|
+
};
|
|
7
18
|
/** - Dot-notation keys for nested objects */
|
|
8
19
|
export type DotNotationKey<T> = T extends GenericObject ? {
|
|
9
20
|
[K in keyof T & string]: T[K] extends GenericObject ? `${K}` | `${K}.${DotNotationKey<T[K]>}` : `${K}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object/types.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EA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,CAAC,CAAC,GAC1B,MAAM;CACR,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAElC,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,KAAK,CAAC,CAAC,IAAI;IAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEjC,6BAA6B;AAC7B,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAElC,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,KAAK,CAAC,CAAC,IAAI;IAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEjC,6BAA6B;AAC7B,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAEzC,+BAA+B;AAC/B,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC"}
|
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.1",
|
|
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"
|