nhb-toolbox 4.0.90 → 4.1.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/dist/cjs/index.js CHANGED
@@ -4,8 +4,8 @@ exports.getFibonacciNumbers = exports.getFibonacci = exports.generateFibonacci =
4
4
  exports.convertHslaToRgba = exports.convertHslaToHex8 = exports.convertHexToRgb = exports.convertHexToHsl = exports.convertHex8ToRgba = exports.convertHex8ToHsla = exports.convertColorCode = exports.generateRandomHSLColor = exports.generateRandomColorInHexRGB = exports.getColorForInitial = exports.getNumbersInRange = exports.roundToNearestInterval = exports.roundToNearest = exports.roundNumberToNearestInterval = exports.roundNumber = exports.numberToOrdinal = exports.getRandomFloat = exports.getRandomDecimal = exports.getOrdinalNumber = exports.getOrdinal = exports.formatCurrency = exports.convertToOrdinal = exports.convertNumberToOrdinal = exports.convertNumberToCurrency = exports.clampNumber = exports.cardinalToOrdinal = exports.isPrimeNumber = exports.isPrime = exports.getPrimeNumbers = exports.findPrimeNumbers = exports.numberToWords = exports.numericToRoman = exports.convertToRomanNumerals = exports.convertNumberToWords = exports.isPerfectSquare = exports.isParOfFibonacciSeries = exports.isParOfFibonacci = exports.isOddNumber = exports.isOdd = exports.isMultiple = exports.isInvalidNumbers = exports.isFibonacci = exports.isEvenNumber = exports.isEven = exports.areInvalidNumbers = exports.getNthFibonacci = exports.getMemoizedFibonacciSeries = exports.getMemoizedFibonacci = exports.getFibonacciSeriesMemo = exports.getFibonacciSeries = void 0;
5
5
  exports.extractDuplicates = exports.createOptionsArray = exports.sortAnArray = exports.Finder = exports.shuffleArray = exports.isValidEmptyArray = exports.isInvalidOrEmptyArray = exports.getLastArrayElement = exports.flattenArray = exports.filterArrayOfObjects = exports.minutesToUTCOffset = exports.getTotalMinutesFromUTC = exports.getTotalMinutesFromTime = exports.getTotalMinutes = exports.getTimeStringFromUTC = exports.getMinutesFromUTC = exports.getCurrentTime = exports.getCurrentDateTime = exports.formatUTCOffset = exports.extractTotalMinutesFromTime = exports.extractTimeStringFromUTC = exports.extractTimeFromUTC = exports.extractMinutesFromUTC = exports.extractHourMinute = exports.convertMinutesToUTCOffset = exports.chronusts = exports.chronusjs = exports.chronus = exports.chronosts = exports.chronosjs = exports.chronos = exports.Chronus = exports.Chronos = exports.isValidUTCOffSet = exports.isValidUTC = exports.isValidTimeString = exports.isValidTime = exports.isLeapYear = exports.greet = exports.getGreeting = exports.generateGreeting = exports.Colour = exports.Color = exports.convertRgbToRgba = exports.convertRgbToHsl = exports.convertRgbToHex = exports.convertRgbaToHsla = exports.convertRgbaToHex8 = exports.convertHslToRgb = exports.convertHslToHex = void 0;
6
6
  exports.remapFields = exports.pickObjectFieldsByCondition = exports.pickObjectFields = exports.pickFieldsByCondition = exports.pickFields = exports.convertObjectValues = exports.sanitizeData = exports.parseStringifiedValues = exports.parseStringifiedPrimitives = exports.parseStringifiedObjectValues = exports.parsePrimitives = exports.parsePrimitiveData = exports.parseObjectValues = exports.parseJsonToObject = exports.mergeObjects = exports.mergeAndFlattenObjects = exports.flattenObjectKeyValue = exports.flattenObjectDotNotation = exports.extractUpdatedFields = exports.extractUpdatedAndNewFields = exports.extractNewFields = exports.countObjectFields = exports.cloneObject = exports.isValidFormData = exports.isOriginFileObj = exports.isFileUpload = exports.isFileList = exports.isFileArray = exports.isCustomFileArray = exports.isCustomFile = exports.serializeForm = exports.parseFormData = exports.createFormData = exports.createControlledFormData = exports.convertIntoFormData = exports.naturalSortForString = exports.naturalSort = exports.compareSorter = exports.compareNaturally = exports.splitArray = exports.rotateArray = exports.removeDuplicatesFromArray = exports.removeDuplicates = exports.moveArrayElement = exports.getMissingElements = exports.getDuplicatesFromArray = exports.getDuplicates = exports.findMissingElements = exports.extractMissingElements = exports.extractDuplicatesFromArray = void 0;
7
- exports.isBigInt = exports.isArrayWithLength = exports.isArrayOfType = exports.isArray = exports.doesReturnPromise = exports.isUndefined = exports.isTruthy = exports.isSymbol = exports.isString = exports.isPrimitive = exports.isPositiveInteger = exports.isNumber = exports.isNull = exports.isNonEmptyString = exports.isInteger = exports.isFalsy = exports.isBoolean = exports.throttleAction = exports.parsePrimitivesDeep = exports.parseJsonDeep = exports.parseJSON = exports.isDeepEqual = exports.getStaticMethodsCount = exports.getStaticMethodNames = exports.getInstanceMethodsCount = exports.getInstanceMethodNames = exports.getClassDetails = exports.deepParsePrimitives = exports.debounceAction = exports.countStaticMethods = exports.countInstanceMethods = exports.convertArrayToString = exports.saveToSessionStorage = exports.saveToLocalStorage = exports.removeFromSessionStorage = exports.removeFromLocalStorage = exports.getFromSessionStorage = exports.getFromLocalStorage = exports.toggleFullScreen = exports.smoothScrollTo = exports.copyToClipboard = exports.updateQueryParam = exports.getQueryStringAsObject = exports.queryStringToObject = exports.parseQueryString = exports.getQueryParams = exports.generateQueryParams = exports.formatQueryParams = exports.createQueryParams = exports.remapObjectFields = void 0;
8
- exports.isValidURL = exports.isValidEmail = exports.isUUID = exports.isURL = exports.isPhoneNumber = exports.isNumericString = exports.isNodeEnvironment = exports.isNodeENV = exports.isNode = exports.isIPAddress = exports.isExpectedNodeENV = exports.isEnvironment = exports.isEmailArray = exports.isEmail = exports.isDateString = exports.isBrowser = exports.isBase64 = exports.isValidSet = exports.isValidObject = exports.isValidMap = exports.isValidJSON = exports.isValidArray = exports.isSet = exports.isReturningPromise = exports.isRegularExpression = exports.isRegExp = exports.isPromise = exports.isObjectWithKeys = exports.isObjectEmpty = exports.isObject = exports.isNotEmptyObject = exports.isMethodDescriptor = exports.isMethod = exports.isMap = exports.isJSONObject = exports.isJSON = exports.isFunction = exports.isError = exports.isEmptyObjectGuard = exports.isEmptyObject = exports.isDate = void 0;
7
+ exports.isArrayWithLength = exports.isArrayOfType = exports.isArray = exports.doesReturnPromise = exports.isUndefined = exports.isTruthy = exports.isSymbol = exports.isString = exports.isPrimitive = exports.isPositiveInteger = exports.isNumber = exports.isNull = exports.isNonEmptyString = exports.isInteger = exports.isFalsy = exports.isBoolean = exports.Paginator = exports.throttleAction = exports.parsePrimitivesDeep = exports.parseJsonDeep = exports.parseJSON = exports.isDeepEqual = exports.getStaticMethodsCount = exports.getStaticMethodNames = exports.getInstanceMethodsCount = exports.getInstanceMethodNames = exports.getClassDetails = exports.deepParsePrimitives = exports.debounceAction = exports.countStaticMethods = exports.countInstanceMethods = exports.convertArrayToString = exports.saveToSessionStorage = exports.saveToLocalStorage = exports.removeFromSessionStorage = exports.removeFromLocalStorage = exports.getFromSessionStorage = exports.getFromLocalStorage = exports.toggleFullScreen = exports.smoothScrollTo = exports.copyToClipboard = exports.updateQueryParam = exports.getQueryStringAsObject = exports.queryStringToObject = exports.parseQueryString = exports.getQueryParams = exports.generateQueryParams = exports.formatQueryParams = exports.createQueryParams = exports.remapObjectFields = void 0;
8
+ exports.isValidURL = exports.isValidEmail = exports.isUUID = exports.isURL = exports.isPhoneNumber = exports.isNumericString = exports.isNodeEnvironment = exports.isNodeENV = exports.isNode = exports.isIPAddress = exports.isExpectedNodeENV = exports.isEnvironment = exports.isEmailArray = exports.isEmail = exports.isDateString = exports.isBrowser = exports.isBase64 = exports.isValidSet = exports.isValidObject = exports.isValidMap = exports.isValidJSON = exports.isValidArray = exports.isSet = exports.isReturningPromise = exports.isRegularExpression = exports.isRegExp = exports.isPromise = exports.isObjectWithKeys = exports.isObjectEmpty = exports.isObject = exports.isNotEmptyObject = exports.isMethodDescriptor = exports.isMethod = exports.isMap = exports.isJSONObject = exports.isJSON = exports.isFunction = exports.isError = exports.isEmptyObjectGuard = exports.isEmptyObject = exports.isDate = exports.isBigInt = void 0;
9
9
  // ! String Utilities
10
10
  var basics_1 = require("./string/basics");
11
11
  Object.defineProperty(exports, "capitalizeString", { enumerable: true, get: function () { return basics_1.capitalizeString; } });
@@ -288,6 +288,8 @@ Object.defineProperty(exports, "parseJSON", { enumerable: true, get: function ()
288
288
  Object.defineProperty(exports, "parseJsonDeep", { enumerable: true, get: function () { return utils_4.parseJSON; } });
289
289
  Object.defineProperty(exports, "parsePrimitivesDeep", { enumerable: true, get: function () { return utils_4.deepParsePrimitives; } });
290
290
  Object.defineProperty(exports, "throttleAction", { enumerable: true, get: function () { return utils_4.throttleAction; } });
291
+ var Paginator_1 = require("./utils/Paginator");
292
+ Object.defineProperty(exports, "Paginator", { enumerable: true, get: function () { return Paginator_1.Paginator; } });
291
293
  // ! Primitive Type Guards
292
294
  var primitives_1 = require("./guards/primitives");
293
295
  Object.defineProperty(exports, "isBoolean", { enumerable: true, get: function () { return primitives_1.isBoolean; } });
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Paginator = void 0;
4
+ /** * Generates pagination logic, offsets, metadata and other pagination logic(s) for APIs and UIs. */
5
+ class Paginator {
6
+ #totalItems;
7
+ #perPage;
8
+ #currentPage;
9
+ /**
10
+ * * Creates an instance of the Paginator.
11
+ * @param options - The options for pagination.
12
+ */
13
+ constructor(options) {
14
+ const { totalItems, itemsPerPage = 10, currentPage = 1, } = options ?? {};
15
+ this.#totalItems = Math.max(0, Number(totalItems));
16
+ this.#perPage = Math.max(1, Number(itemsPerPage));
17
+ this.#currentPage = Math.max(1, Number(currentPage));
18
+ }
19
+ /**
20
+ * @instance Returns a new Paginator instance with the given page number.
21
+ * * This method does not modify the current instance.
22
+ * - **N.B.** *If the provided page is out of range, it will be clamped between 1 and the last page.*
23
+ * @param page - The new current page to use.
24
+ * @returns A new Paginator instance with the updated (clamped) page.
25
+ */
26
+ withPage(page) {
27
+ const safePage = Math.min(Math.max(1, page), this.totalPages());
28
+ return new Paginator({
29
+ totalItems: this.#totalItems,
30
+ itemsPerPage: this.#perPage,
31
+ currentPage: safePage,
32
+ });
33
+ }
34
+ /**
35
+ * @instance Returns a new Paginator instance with the given items per page.
36
+ * - **N.B.** *If the value is less than `1`, it will be clamped to 1.*
37
+ * @param perPage - New items per page value.
38
+ * @returns A new Paginator instance with updated items per page.
39
+ */
40
+ withPerPage(perPage) {
41
+ const safePerPage = Math.max(1, perPage);
42
+ return new Paginator({
43
+ totalItems: this.#totalItems,
44
+ itemsPerPage: safePerPage,
45
+ currentPage: this.#currentPage,
46
+ });
47
+ }
48
+ /**
49
+ * @instance Returns a new Paginator instance with the given total items.
50
+ * - **N.B.** *If the value is `negative`, it will be clamped to `0`.*
51
+ * @param totalItems - New total items value.
52
+ * @returns A new Paginator instance with updated total items.
53
+ */
54
+ withTotalItems(totalItems) {
55
+ const safeTotalItems = Math.max(0, totalItems);
56
+ return new Paginator({
57
+ totalItems: safeTotalItems,
58
+ itemsPerPage: this.#perPage,
59
+ currentPage: this.#currentPage,
60
+ });
61
+ }
62
+ /**
63
+ * @instance Returns a new Paginator instance with updated pagination options.
64
+ * - **N.B.** *Any value provided will override the existing one, with clamping applied for safety.*
65
+ * @param options - Partial pagination options to override the current instance.
66
+ * @returns A new Paginator instance with merged and clamped options.
67
+ */
68
+ withOptions(options) {
69
+ const newTotalItems = Math.max(0, options.totalItems ? Number(options.totalItems) : this.#totalItems);
70
+ const newItemsPerPage = Math.max(1, options.itemsPerPage ? Number(options.itemsPerPage) : this.#perPage);
71
+ const totalPages = Math.ceil(newTotalItems / newItemsPerPage);
72
+ const newCurrentPage = Math.min(Math.max(1, options.currentPage ?
73
+ Number(options.currentPage)
74
+ : this.#currentPage), totalPages);
75
+ return new Paginator({
76
+ totalItems: newTotalItems,
77
+ itemsPerPage: newItemsPerPage,
78
+ currentPage: newCurrentPage,
79
+ });
80
+ }
81
+ /**
82
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
83
+ * @returns The number of items to skip.
84
+ */
85
+ offset() {
86
+ return (this.#currentPage - 1) * this.#perPage;
87
+ }
88
+ /**
89
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
90
+ * @alias of {@link offset}
91
+ * @returns The number of items to skip.
92
+ */
93
+ getOffset() {
94
+ return this.offset();
95
+ }
96
+ /**
97
+ * @instance Calculates the number of items to skip based on the `current page` and `items per page`.
98
+ * @alias of {@link offset}
99
+ * @returns The number of items to skip.
100
+ */
101
+ skipCount() {
102
+ return this.offset();
103
+ }
104
+ /**
105
+ * @instance Calculates the total number of pages based on `total items` and `items per page`.
106
+ * @returns The total number of pages.
107
+ */
108
+ totalPages() {
109
+ return Math.ceil(this.#totalItems / this.#perPage);
110
+ }
111
+ /**
112
+ * * Returns pagination metadata useful for API responses or UI rendering.
113
+ * @returns An object with pagination metadata.
114
+ */
115
+ getMeta() {
116
+ const totalPages = this.totalPages();
117
+ return {
118
+ totalItems: this.#totalItems,
119
+ currentPage: this.#currentPage,
120
+ itemsPerPage: this.#perPage,
121
+ totalPages,
122
+ hasPrev: this.hasPrevPage(),
123
+ hasNext: this.hasNextPage(),
124
+ isFirst: this.isFirstPage(),
125
+ isLast: this.isLastPage(),
126
+ offset: this.offset(),
127
+ };
128
+ }
129
+ /**
130
+ * @instance Returns the next page number if it exists.
131
+ * @returns The next page number or null if it's the last page.
132
+ */
133
+ nextPage() {
134
+ return this.#currentPage < this.totalPages() ?
135
+ this.#currentPage + 1
136
+ : null;
137
+ }
138
+ /**
139
+ * @instance Returns the previous page number if it exists.
140
+ * @returns The previous page number or null if it's the first page.
141
+ */
142
+ prevPage() {
143
+ return this.#currentPage > 1 ? this.#currentPage - 1 : null;
144
+ }
145
+ /**
146
+ * @instance Checks if the current page is the first page.
147
+ * @returns Whether the current page is the first page.
148
+ */
149
+ isFirstPage() {
150
+ return this.#currentPage === 1;
151
+ }
152
+ /**
153
+ * @instance Checks if the current page is the last page.
154
+ * @returns Whether the current page is the last page.
155
+ */
156
+ isLastPage() {
157
+ return this.#currentPage === this.totalPages();
158
+ }
159
+ /**
160
+ * @instance Checks if a previous page exists.
161
+ * @returns Whether a previous page exists.
162
+ */
163
+ hasPrevPage() {
164
+ return this.#currentPage > 1;
165
+ }
166
+ /**
167
+ * @instance Checks if a next page exists.
168
+ * @returns Whether a next page exists.
169
+ */
170
+ hasNextPage() {
171
+ return this.#currentPage < this.totalPages();
172
+ }
173
+ /**
174
+ * @instance Creates an array of page numbers for UI pagination display.
175
+ * @param options Options for customizing the page list.
176
+ * @returns An array of visible page numbers.
177
+ */
178
+ pageList(options = {}) {
179
+ const total = this.totalPages();
180
+ const edgeCount = Math.max(0, options.edgeCount ?? 1);
181
+ const siblingCount = Math.max(0, options.siblingCount ?? 1);
182
+ const start = Math.max(this.#currentPage - siblingCount, edgeCount + 1);
183
+ const end = Math.min(this.#currentPage + siblingCount, total - edgeCount);
184
+ const _getRange = (from, to) => {
185
+ return from > to ?
186
+ []
187
+ : Array.from({ length: to - from + 1 }, (_, i) => from + i);
188
+ };
189
+ const startPages = _getRange(1, edgeCount);
190
+ const middlePages = _getRange(start, end);
191
+ const endPages = _getRange(total - edgeCount + 1, total);
192
+ const pages = new Set([
193
+ ...startPages,
194
+ ...middlePages,
195
+ ...endPages,
196
+ ]);
197
+ return Array.from(pages).sort((a, b) => a - b);
198
+ }
199
+ /**
200
+ * @instance Returns the first page number.
201
+ * @returns Always returns 1.
202
+ */
203
+ firstPage() {
204
+ return 1;
205
+ }
206
+ /**
207
+ * @instance Returns the last page number based on total items and per page count.
208
+ * @returns The last page number.
209
+ */
210
+ lastPage() {
211
+ return this.totalPages();
212
+ }
213
+ /**
214
+ * @instance Checks if a page number is valid within the pagination range.
215
+ * @param page - The page number to validate.
216
+ * @returns Whether the page number is within range.
217
+ */
218
+ isPageValid(page) {
219
+ const p = Math.floor(page);
220
+ return p >= 1 && p <= this.totalPages();
221
+ }
222
+ /**
223
+ * @static Creates a new Paginator instance from a meta object.
224
+ * @param meta - A pagination metadata object.
225
+ * @returns A new Paginator instance.
226
+ */
227
+ static fromMeta(meta) {
228
+ return new Paginator({
229
+ totalItems: meta.totalItems,
230
+ itemsPerPage: meta.itemsPerPage,
231
+ currentPage: meta.currentPage,
232
+ });
233
+ }
234
+ }
235
+ exports.Paginator = Paginator;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -38,6 +38,7 @@ export { generateQueryParams as createQueryParams, generateQueryParams as format
38
38
  export { copyToClipboard, smoothScrollTo, toggleFullScreen } from './dom/utils';
39
39
  export { getFromLocalStorage, getFromSessionStorage, removeFromLocalStorage, removeFromSessionStorage, saveToLocalStorage, saveToSessionStorage, } from './dom/storage';
40
40
  export { convertArrayToString, countInstanceMethods, countStaticMethods, debounceAction, deepParsePrimitives, getClassDetails, getInstanceMethodNames, countInstanceMethods as getInstanceMethodsCount, getStaticMethodNames, countStaticMethods as getStaticMethodsCount, isDeepEqual, parseJSON, parseJSON as parseJsonDeep, deepParsePrimitives as parsePrimitivesDeep, throttleAction, } from './utils';
41
+ export { Paginator } from './utils/Paginator';
41
42
  export { isBoolean, isFalsy, isInteger, isNonEmptyString, isNull, isNumber, isPositiveInteger, isPrimitive, isString, isSymbol, isTruthy, isUndefined, } from './guards/primitives';
42
43
  export { isReturningPromise as doesReturnPromise, isArray, isArrayOfType, isValidArray as isArrayWithLength, isBigInt, isDate, isEmptyObject, isEmptyObject as isEmptyObjectGuard, isError, isFunction, isJSON, isJSON as isJSONObject, isMap, isMethodDescriptor as isMethod, isMethodDescriptor, isNotEmptyObject, isObject, isEmptyObject as isObjectEmpty, isObjectWithKeys, isPromise, isRegExp, isRegExp as isRegularExpression, isReturningPromise, isSet, isValidArray, isJSON as isValidJSON, isMap as isValidMap, isNotEmptyObject as isValidObject, isSet as isValidSet, } from './guards/non-primitives';
43
44
  export { isBase64, isBrowser, isDateString, isEmail, isEmailArray, isEnvironment, isEnvironment as isExpectedNodeENV, isIPAddress, isNode, isEnvironment as isNodeENV, isEnvironment as isNodeEnvironment, isNumericString, isPhoneNumber, isURL, isUUID, isEmail as isValidEmail, isURL as isValidURL, } from './guards/specials';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,iBAAiB,CAA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,IAAI,mBAAmB,EAC/B,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,MAAM,IAAI,WAAW,EACrB,KAAK,IAAI,UAAU,EACnB,gBAAgB,IAAI,aAAa,EACjC,KAAK,IAAI,UAAU,GACnB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,iBAAiB,EAClC,WAAW,EACX,MAAM,EACN,aAAa,IAAI,SAAS,EAC1B,aAAa,IAAI,iBAAiB,EAClC,eAAe,EACf,aAAa,EACb,KAAK,EACL,MAAM,EACN,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,GACnB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,oBAAoB,IAAI,0BAA0B,EAClD,oBAAoB,EACpB,oBAAoB,IAAI,gBAAgB,EACxC,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,aAAa,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,UAAU,EACV,UAAU,IAAI,kBAAkB,EAChC,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,IAAI,mBAAmB,EAC7C,UAAU,IAAI,SAAS,GACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACN,UAAU,IAAI,gBAAgB,EAC9B,YAAY,IAAI,YAAY,EAC5B,YAAY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EACT,SAAS,IAAI,aAAa,EAC1B,mBAAmB,IAAI,mBAAmB,EAC1C,cAAc,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,GACX,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,kBAAkB,IAAI,iBAAiB,EACvC,OAAO,EACP,aAAa,EACb,YAAY,IAAI,iBAAiB,EACjC,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,IAAI,kBAAkB,EACnC,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,IAAI,YAAY,EACtB,KAAK,EACL,kBAAkB,IAAI,QAAQ,EAC9B,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,aAAa,IAAI,aAAa,EAC9B,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,QAAQ,IAAI,mBAAmB,EAC/B,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,MAAM,IAAI,WAAW,EACrB,KAAK,IAAI,UAAU,EACnB,gBAAgB,IAAI,aAAa,EACjC,KAAK,IAAI,UAAU,GACnB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,iBAAiB,EAClC,WAAW,EACX,MAAM,EACN,aAAa,IAAI,SAAS,EAC1B,aAAa,IAAI,iBAAiB,EAClC,eAAe,EACf,aAAa,EACb,KAAK,EACL,MAAM,EACN,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,GACnB,MAAM,mBAAmB,CAAC"}
@@ -16,10 +16,10 @@ export declare function sanitizeData(input: string): string;
16
16
  export declare function sanitizeData(input: string[]): string[];
17
17
  /**
18
18
  * * Sanitizes an object by ignoring specified keys and trimming string values based on options provided.
19
- * * Also excludes nullish values (null, undefined) if specified. Always ignores empty nested object(s).
19
+ * * Also excludes nullish values (`null`, `undefined`), falsy (`nullish` + `0` & `""`) or empty values (`object`, `array`) if specified.
20
20
  *
21
21
  * @param object - The object to sanitize.
22
- * @param options - Options that define which keys to ignore, whether to trim string values, and whether to exclude nullish values.
22
+ * @param options - Options that define which keys to ignore, whether to trim string values, and whether to exclude nullish, falsy or empty values.
23
23
  * @returns A new object with the specified modifications.
24
24
  */
25
25
  export declare function sanitizeData<T extends GenericObject>(object: T, options?: SanitizeOptions<T>): FlattenPartial<T>;
@@ -0,0 +1,125 @@
1
+ import type { FromMetaOptions, PageListOptions, PaginatorMeta, PaginatorOptions } from './types';
2
+ /** * Generates pagination logic, offsets, metadata and other pagination logic(s) for APIs and UIs. */
3
+ export declare class Paginator {
4
+ #private;
5
+ /**
6
+ * * Creates an instance of the Paginator.
7
+ * @param options - The options for pagination.
8
+ */
9
+ constructor(options: PaginatorOptions);
10
+ /**
11
+ * @instance Returns a new Paginator instance with the given page number.
12
+ * * This method does not modify the current instance.
13
+ * - **N.B.** *If the provided page is out of range, it will be clamped between 1 and the last page.*
14
+ * @param page - The new current page to use.
15
+ * @returns A new Paginator instance with the updated (clamped) page.
16
+ */
17
+ withPage(page: number): Paginator;
18
+ /**
19
+ * @instance Returns a new Paginator instance with the given items per page.
20
+ * - **N.B.** *If the value is less than `1`, it will be clamped to 1.*
21
+ * @param perPage - New items per page value.
22
+ * @returns A new Paginator instance with updated items per page.
23
+ */
24
+ withPerPage(perPage: number): Paginator;
25
+ /**
26
+ * @instance Returns a new Paginator instance with the given total items.
27
+ * - **N.B.** *If the value is `negative`, it will be clamped to `0`.*
28
+ * @param totalItems - New total items value.
29
+ * @returns A new Paginator instance with updated total items.
30
+ */
31
+ withTotalItems(totalItems: number): Paginator;
32
+ /**
33
+ * @instance Returns a new Paginator instance with updated pagination options.
34
+ * - **N.B.** *Any value provided will override the existing one, with clamping applied for safety.*
35
+ * @param options - Partial pagination options to override the current instance.
36
+ * @returns A new Paginator instance with merged and clamped options.
37
+ */
38
+ withOptions(options: Partial<PaginatorOptions>): Paginator;
39
+ /**
40
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
41
+ * @returns The number of items to skip.
42
+ */
43
+ offset(): number;
44
+ /**
45
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
46
+ * @alias of {@link offset}
47
+ * @returns The number of items to skip.
48
+ */
49
+ getOffset(): number;
50
+ /**
51
+ * @instance Calculates the number of items to skip based on the `current page` and `items per page`.
52
+ * @alias of {@link offset}
53
+ * @returns The number of items to skip.
54
+ */
55
+ skipCount(): number;
56
+ /**
57
+ * @instance Calculates the total number of pages based on `total items` and `items per page`.
58
+ * @returns The total number of pages.
59
+ */
60
+ totalPages(): number;
61
+ /**
62
+ * * Returns pagination metadata useful for API responses or UI rendering.
63
+ * @returns An object with pagination metadata.
64
+ */
65
+ getMeta(): PaginatorMeta;
66
+ /**
67
+ * @instance Returns the next page number if it exists.
68
+ * @returns The next page number or null if it's the last page.
69
+ */
70
+ nextPage(): number | null;
71
+ /**
72
+ * @instance Returns the previous page number if it exists.
73
+ * @returns The previous page number or null if it's the first page.
74
+ */
75
+ prevPage(): number | null;
76
+ /**
77
+ * @instance Checks if the current page is the first page.
78
+ * @returns Whether the current page is the first page.
79
+ */
80
+ isFirstPage(): boolean;
81
+ /**
82
+ * @instance Checks if the current page is the last page.
83
+ * @returns Whether the current page is the last page.
84
+ */
85
+ isLastPage(): boolean;
86
+ /**
87
+ * @instance Checks if a previous page exists.
88
+ * @returns Whether a previous page exists.
89
+ */
90
+ hasPrevPage(): boolean;
91
+ /**
92
+ * @instance Checks if a next page exists.
93
+ * @returns Whether a next page exists.
94
+ */
95
+ hasNextPage(): boolean;
96
+ /**
97
+ * @instance Creates an array of page numbers for UI pagination display.
98
+ * @param options Options for customizing the page list.
99
+ * @returns An array of visible page numbers.
100
+ */
101
+ pageList(options?: PageListOptions): number[];
102
+ /**
103
+ * @instance Returns the first page number.
104
+ * @returns Always returns 1.
105
+ */
106
+ firstPage(): number;
107
+ /**
108
+ * @instance Returns the last page number based on total items and per page count.
109
+ * @returns The last page number.
110
+ */
111
+ lastPage(): number;
112
+ /**
113
+ * @instance Checks if a page number is valid within the pagination range.
114
+ * @param page - The page number to validate.
115
+ * @returns Whether the page number is within range.
116
+ */
117
+ isPageValid(page: number): boolean;
118
+ /**
119
+ * @static Creates a new Paginator instance from a meta object.
120
+ * @param meta - A pagination metadata object.
121
+ * @returns A new Paginator instance.
122
+ */
123
+ static fromMeta(meta: FromMetaOptions): Paginator;
124
+ }
125
+ //# sourceMappingURL=Paginator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Paginator.d.ts","sourceRoot":"","sources":["../../../src/utils/Paginator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,MAAM,SAAS,CAAC;AAEjB,sGAAsG;AACtG,qBAAa,SAAS;;IAKrB;;;OAGG;gBACS,OAAO,EAAE,gBAAgB;IAYrC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAUjC;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;IASvC;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;IAS7C;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS;IA2B1D;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,OAAO,IAAI,aAAa;IAexB;;;OAGG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI;IAMzB;;;OAGG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;;OAGG;IACH,UAAU,IAAI,OAAO;IAIrB;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,MAAM,EAAE;IA6BjD;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAKlC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS;CAOjD"}
@@ -0,0 +1,30 @@
1
+ import type { Numeric } from '../types';
2
+ export interface PaginatorOptions {
3
+ /** The total number of items. */
4
+ totalItems: Numeric;
5
+ /** Number of items per page. (Default is `10`). */
6
+ itemsPerPage?: Numeric;
7
+ /** Current active page. (Default is `1`). */
8
+ currentPage?: Numeric;
9
+ }
10
+ export interface PaginatorMeta {
11
+ totalItems: number;
12
+ currentPage: number;
13
+ itemsPerPage: number;
14
+ totalPages: number;
15
+ hasPrev: boolean;
16
+ hasNext: boolean;
17
+ isFirst: boolean;
18
+ isLast: boolean;
19
+ offset: number;
20
+ }
21
+ /** Options for `fromMeta` method. */
22
+ export type FromMetaOptions = Pick<PaginatorMeta, 'totalItems' | 'itemsPerPage' | 'currentPage'>;
23
+ /** Options for pageList method. */
24
+ export interface PageListOptions {
25
+ /** Number of edge pages to always show (default 1). */
26
+ edgeCount?: number;
27
+ /** Number of siblings pages to show around the current page (default 1). */
28
+ siblingCount?: number;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAChC,iCAAiC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,qCAAqC;AACrC,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,aAAa,EACb,YAAY,GAAG,cAAc,GAAG,aAAa,CAC7C,CAAC;AAEF,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC/B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/dist/esm/index.js CHANGED
@@ -47,6 +47,7 @@ export { copyToClipboard, smoothScrollTo, toggleFullScreen } from './dom/utils';
47
47
  export { getFromLocalStorage, getFromSessionStorage, removeFromLocalStorage, removeFromSessionStorage, saveToLocalStorage, saveToSessionStorage, } from './dom/storage';
48
48
  // ! Other Utilities
49
49
  export { convertArrayToString, countInstanceMethods, countStaticMethods, debounceAction, deepParsePrimitives, getClassDetails, getInstanceMethodNames, countInstanceMethods as getInstanceMethodsCount, getStaticMethodNames, countStaticMethods as getStaticMethodsCount, isDeepEqual, parseJSON, parseJSON as parseJsonDeep, deepParsePrimitives as parsePrimitivesDeep, throttleAction, } from './utils';
50
+ export { Paginator } from './utils/Paginator';
50
51
  // ! Primitive Type Guards
51
52
  export { isBoolean, isFalsy, isInteger, isNonEmptyString, isNull, isNumber, isPositiveInteger, isPrimitive, isString, isSymbol, isTruthy, isUndefined, } from './guards/primitives';
52
53
  // ! Non-Primitive Type Guards
@@ -0,0 +1,231 @@
1
+ /** * Generates pagination logic, offsets, metadata and other pagination logic(s) for APIs and UIs. */
2
+ export class Paginator {
3
+ #totalItems;
4
+ #perPage;
5
+ #currentPage;
6
+ /**
7
+ * * Creates an instance of the Paginator.
8
+ * @param options - The options for pagination.
9
+ */
10
+ constructor(options) {
11
+ const { totalItems, itemsPerPage = 10, currentPage = 1, } = options ?? {};
12
+ this.#totalItems = Math.max(0, Number(totalItems));
13
+ this.#perPage = Math.max(1, Number(itemsPerPage));
14
+ this.#currentPage = Math.max(1, Number(currentPage));
15
+ }
16
+ /**
17
+ * @instance Returns a new Paginator instance with the given page number.
18
+ * * This method does not modify the current instance.
19
+ * - **N.B.** *If the provided page is out of range, it will be clamped between 1 and the last page.*
20
+ * @param page - The new current page to use.
21
+ * @returns A new Paginator instance with the updated (clamped) page.
22
+ */
23
+ withPage(page) {
24
+ const safePage = Math.min(Math.max(1, page), this.totalPages());
25
+ return new Paginator({
26
+ totalItems: this.#totalItems,
27
+ itemsPerPage: this.#perPage,
28
+ currentPage: safePage,
29
+ });
30
+ }
31
+ /**
32
+ * @instance Returns a new Paginator instance with the given items per page.
33
+ * - **N.B.** *If the value is less than `1`, it will be clamped to 1.*
34
+ * @param perPage - New items per page value.
35
+ * @returns A new Paginator instance with updated items per page.
36
+ */
37
+ withPerPage(perPage) {
38
+ const safePerPage = Math.max(1, perPage);
39
+ return new Paginator({
40
+ totalItems: this.#totalItems,
41
+ itemsPerPage: safePerPage,
42
+ currentPage: this.#currentPage,
43
+ });
44
+ }
45
+ /**
46
+ * @instance Returns a new Paginator instance with the given total items.
47
+ * - **N.B.** *If the value is `negative`, it will be clamped to `0`.*
48
+ * @param totalItems - New total items value.
49
+ * @returns A new Paginator instance with updated total items.
50
+ */
51
+ withTotalItems(totalItems) {
52
+ const safeTotalItems = Math.max(0, totalItems);
53
+ return new Paginator({
54
+ totalItems: safeTotalItems,
55
+ itemsPerPage: this.#perPage,
56
+ currentPage: this.#currentPage,
57
+ });
58
+ }
59
+ /**
60
+ * @instance Returns a new Paginator instance with updated pagination options.
61
+ * - **N.B.** *Any value provided will override the existing one, with clamping applied for safety.*
62
+ * @param options - Partial pagination options to override the current instance.
63
+ * @returns A new Paginator instance with merged and clamped options.
64
+ */
65
+ withOptions(options) {
66
+ const newTotalItems = Math.max(0, options.totalItems ? Number(options.totalItems) : this.#totalItems);
67
+ const newItemsPerPage = Math.max(1, options.itemsPerPage ? Number(options.itemsPerPage) : this.#perPage);
68
+ const totalPages = Math.ceil(newTotalItems / newItemsPerPage);
69
+ const newCurrentPage = Math.min(Math.max(1, options.currentPage ?
70
+ Number(options.currentPage)
71
+ : this.#currentPage), totalPages);
72
+ return new Paginator({
73
+ totalItems: newTotalItems,
74
+ itemsPerPage: newItemsPerPage,
75
+ currentPage: newCurrentPage,
76
+ });
77
+ }
78
+ /**
79
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
80
+ * @returns The number of items to skip.
81
+ */
82
+ offset() {
83
+ return (this.#currentPage - 1) * this.#perPage;
84
+ }
85
+ /**
86
+ * @instance Calculates the offset (number of items to skip) based on the `current page` and `items per page`.
87
+ * @alias of {@link offset}
88
+ * @returns The number of items to skip.
89
+ */
90
+ getOffset() {
91
+ return this.offset();
92
+ }
93
+ /**
94
+ * @instance Calculates the number of items to skip based on the `current page` and `items per page`.
95
+ * @alias of {@link offset}
96
+ * @returns The number of items to skip.
97
+ */
98
+ skipCount() {
99
+ return this.offset();
100
+ }
101
+ /**
102
+ * @instance Calculates the total number of pages based on `total items` and `items per page`.
103
+ * @returns The total number of pages.
104
+ */
105
+ totalPages() {
106
+ return Math.ceil(this.#totalItems / this.#perPage);
107
+ }
108
+ /**
109
+ * * Returns pagination metadata useful for API responses or UI rendering.
110
+ * @returns An object with pagination metadata.
111
+ */
112
+ getMeta() {
113
+ const totalPages = this.totalPages();
114
+ return {
115
+ totalItems: this.#totalItems,
116
+ currentPage: this.#currentPage,
117
+ itemsPerPage: this.#perPage,
118
+ totalPages,
119
+ hasPrev: this.hasPrevPage(),
120
+ hasNext: this.hasNextPage(),
121
+ isFirst: this.isFirstPage(),
122
+ isLast: this.isLastPage(),
123
+ offset: this.offset(),
124
+ };
125
+ }
126
+ /**
127
+ * @instance Returns the next page number if it exists.
128
+ * @returns The next page number or null if it's the last page.
129
+ */
130
+ nextPage() {
131
+ return this.#currentPage < this.totalPages() ?
132
+ this.#currentPage + 1
133
+ : null;
134
+ }
135
+ /**
136
+ * @instance Returns the previous page number if it exists.
137
+ * @returns The previous page number or null if it's the first page.
138
+ */
139
+ prevPage() {
140
+ return this.#currentPage > 1 ? this.#currentPage - 1 : null;
141
+ }
142
+ /**
143
+ * @instance Checks if the current page is the first page.
144
+ * @returns Whether the current page is the first page.
145
+ */
146
+ isFirstPage() {
147
+ return this.#currentPage === 1;
148
+ }
149
+ /**
150
+ * @instance Checks if the current page is the last page.
151
+ * @returns Whether the current page is the last page.
152
+ */
153
+ isLastPage() {
154
+ return this.#currentPage === this.totalPages();
155
+ }
156
+ /**
157
+ * @instance Checks if a previous page exists.
158
+ * @returns Whether a previous page exists.
159
+ */
160
+ hasPrevPage() {
161
+ return this.#currentPage > 1;
162
+ }
163
+ /**
164
+ * @instance Checks if a next page exists.
165
+ * @returns Whether a next page exists.
166
+ */
167
+ hasNextPage() {
168
+ return this.#currentPage < this.totalPages();
169
+ }
170
+ /**
171
+ * @instance Creates an array of page numbers for UI pagination display.
172
+ * @param options Options for customizing the page list.
173
+ * @returns An array of visible page numbers.
174
+ */
175
+ pageList(options = {}) {
176
+ const total = this.totalPages();
177
+ const edgeCount = Math.max(0, options.edgeCount ?? 1);
178
+ const siblingCount = Math.max(0, options.siblingCount ?? 1);
179
+ const start = Math.max(this.#currentPage - siblingCount, edgeCount + 1);
180
+ const end = Math.min(this.#currentPage + siblingCount, total - edgeCount);
181
+ const _getRange = (from, to) => {
182
+ return from > to ?
183
+ []
184
+ : Array.from({ length: to - from + 1 }, (_, i) => from + i);
185
+ };
186
+ const startPages = _getRange(1, edgeCount);
187
+ const middlePages = _getRange(start, end);
188
+ const endPages = _getRange(total - edgeCount + 1, total);
189
+ const pages = new Set([
190
+ ...startPages,
191
+ ...middlePages,
192
+ ...endPages,
193
+ ]);
194
+ return Array.from(pages).sort((a, b) => a - b);
195
+ }
196
+ /**
197
+ * @instance Returns the first page number.
198
+ * @returns Always returns 1.
199
+ */
200
+ firstPage() {
201
+ return 1;
202
+ }
203
+ /**
204
+ * @instance Returns the last page number based on total items and per page count.
205
+ * @returns The last page number.
206
+ */
207
+ lastPage() {
208
+ return this.totalPages();
209
+ }
210
+ /**
211
+ * @instance Checks if a page number is valid within the pagination range.
212
+ * @param page - The page number to validate.
213
+ * @returns Whether the page number is within range.
214
+ */
215
+ isPageValid(page) {
216
+ const p = Math.floor(page);
217
+ return p >= 1 && p <= this.totalPages();
218
+ }
219
+ /**
220
+ * @static Creates a new Paginator instance from a meta object.
221
+ * @param meta - A pagination metadata object.
222
+ * @returns A new Paginator instance.
223
+ */
224
+ static fromMeta(meta) {
225
+ return new Paginator({
226
+ totalItems: meta.totalItems,
227
+ itemsPerPage: meta.itemsPerPage,
228
+ currentPage: meta.currentPage,
229
+ });
230
+ }
231
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.0.90",
3
+ "version": "4.1.00",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -112,6 +112,10 @@
112
112
  "./string/types": {
113
113
  "types": "./dist/dts/string/types.d.ts",
114
114
  "default": "./dist/dts/string/types.d.ts"
115
+ },
116
+ "./utils/types": {
117
+ "types": "./dist/dts/utils/types.d.ts",
118
+ "default": "./dist/dts/utils/types.d.ts"
115
119
  }
116
120
  },
117
121
  "typesVersions": {
@@ -139,6 +143,9 @@
139
143
  ],
140
144
  "string/types": [
141
145
  "dist/dts/string/types.d.ts"
146
+ ],
147
+ "utils/types": [
148
+ "dist/dts/utils/types.d.ts"
142
149
  ]
143
150
  }
144
151
  },