@alextheman/utility 2.16.1 → 2.17.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/index.cjs CHANGED
@@ -51,11 +51,13 @@ __export(index_exports, {
51
51
  camelToKebab: () => camelToKebab_default,
52
52
  convertFileToBase64: () => convertFileToBase64_default,
53
53
  createFormData: () => createFormData_default,
54
+ createTemplateStringsArray: () => createTemplateStringsArray_default,
54
55
  fillArray: () => fillArray_default,
55
56
  formatDateAndTime: () => formatDateAndTime_default,
56
57
  getRandomNumber: () => getRandomNumber_default,
57
58
  getRecordKeys: () => getRecordKeys_default,
58
59
  httpErrorCodeLookup: () => httpErrorCodeLookup,
60
+ interpolate: () => interpolate_default,
59
61
  interpolateObjects: () => interpolateObjects_default,
60
62
  isLeapYear: () => isLeapYear_default,
61
63
  isMonthlyMultiple: () => isMonthlyMultiple_default,
@@ -211,6 +213,12 @@ function createFormData(data, options = {
211
213
  }
212
214
  var createFormData_default = createFormData;
213
215
 
216
+ // src/functions/createTemplateStringsArray.ts
217
+ function createTemplateStringsArray(strings) {
218
+ return Object.assign([...strings], { raw: [...strings] });
219
+ }
220
+ var createTemplateStringsArray_default = createTemplateStringsArray;
221
+
214
222
  // src/functions/fillArray.ts
215
223
  function fillArray(callback, length = 1) {
216
224
  const outputArray = new Array(length).fill(null).map((_, index) => {
@@ -487,6 +495,16 @@ function wait(seconds) {
487
495
  }
488
496
  var wait_default = wait;
489
497
 
498
+ // src/functions/taggedTemplate/interpolate.ts
499
+ function interpolate(strings, ...interpolations) {
500
+ let result = "";
501
+ for (const [string, interpolation = ""] of paralleliseArrays_default(strings, interpolations)) {
502
+ result += string + interpolation;
503
+ }
504
+ return result;
505
+ }
506
+ var interpolate_default = interpolate;
507
+
490
508
  // src/functions/taggedTemplate/interpolateObjects.ts
491
509
  function interpolateObjects(strings, ...values) {
492
510
  let result = "";
@@ -563,11 +581,13 @@ var UUID_default = parseUUID;
563
581
  camelToKebab,
564
582
  convertFileToBase64,
565
583
  createFormData,
584
+ createTemplateStringsArray,
566
585
  fillArray,
567
586
  formatDateAndTime,
568
587
  getRandomNumber,
569
588
  getRecordKeys,
570
589
  httpErrorCodeLookup,
590
+ interpolate,
571
591
  interpolateObjects,
572
592
  isLeapYear,
573
593
  isMonthlyMultiple,
package/dist/index.d.cts CHANGED
@@ -62,6 +62,8 @@ interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends C
62
62
  type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
63
63
  declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
64
64
 
65
+ declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
66
+
65
67
  declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
66
68
  declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
67
69
 
@@ -109,6 +111,8 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
109
111
 
110
112
  declare function wait(seconds: number): Promise<void>;
111
113
 
114
+ declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
115
+
112
116
  declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
113
117
 
114
- export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type StringListToArrayOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringListToArray, stringToBoolean, truncate, wait };
118
+ export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type StringListToArrayOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringListToArray, stringToBoolean, truncate, wait };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,8 @@ interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends C
62
62
  type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
63
63
  declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
64
64
 
65
+ declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
66
+
65
67
  declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
66
68
  declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
67
69
 
@@ -109,6 +111,8 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
109
111
 
110
112
  declare function wait(seconds: number): Promise<void>;
111
113
 
114
+ declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
115
+
112
116
  declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
113
117
 
114
- export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type StringListToArrayOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringListToArray, stringToBoolean, truncate, wait };
118
+ export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type StringListToArrayOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringListToArray, stringToBoolean, truncate, wait };
package/dist/index.js CHANGED
@@ -149,6 +149,12 @@ function createFormData(data, options = {
149
149
  }
150
150
  var createFormData_default = createFormData;
151
151
 
152
+ // src/functions/createTemplateStringsArray.ts
153
+ function createTemplateStringsArray(strings) {
154
+ return Object.assign([...strings], { raw: [...strings] });
155
+ }
156
+ var createTemplateStringsArray_default = createTemplateStringsArray;
157
+
152
158
  // src/functions/fillArray.ts
153
159
  function fillArray(callback, length = 1) {
154
160
  const outputArray = new Array(length).fill(null).map((_, index) => {
@@ -425,6 +431,16 @@ function wait(seconds) {
425
431
  }
426
432
  var wait_default = wait;
427
433
 
434
+ // src/functions/taggedTemplate/interpolate.ts
435
+ function interpolate(strings, ...interpolations) {
436
+ let result = "";
437
+ for (const [string, interpolation = ""] of paralleliseArrays_default(strings, interpolations)) {
438
+ result += string + interpolation;
439
+ }
440
+ return result;
441
+ }
442
+ var interpolate_default = interpolate;
443
+
428
444
  // src/functions/taggedTemplate/interpolateObjects.ts
429
445
  function interpolateObjects(strings, ...values) {
430
446
  let result = "";
@@ -500,11 +516,13 @@ export {
500
516
  camelToKebab_default as camelToKebab,
501
517
  convertFileToBase64_default as convertFileToBase64,
502
518
  createFormData_default as createFormData,
519
+ createTemplateStringsArray_default as createTemplateStringsArray,
503
520
  fillArray_default as fillArray,
504
521
  formatDateAndTime_default as formatDateAndTime,
505
522
  getRandomNumber_default as getRandomNumber,
506
523
  getRecordKeys_default as getRecordKeys,
507
524
  httpErrorCodeLookup,
525
+ interpolate_default as interpolate,
508
526
  interpolateObjects_default as interpolateObjects,
509
527
  isLeapYear_default as isLeapYear,
510
528
  isMonthlyMultiple_default as isMonthlyMultiple,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "Helpful utility functions",
5
5
  "repository": {
6
6
  "type": "git",