@ditojs/utils 1.26.0 → 1.28.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/types/index.d.ts +25 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/utils",
3
- "version": "1.26.0",
3
+ "version": "1.28.0",
4
4
  "type": "module",
5
5
  "description": "Dito.js Utility Functions – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/utils",
@@ -32,7 +32,7 @@
32
32
  "typescript": "^4.9.5"
33
33
  },
34
34
  "types": "types",
35
- "gitHead": "198c9832c863003c8c8fcd147bf61a5f99a39c91",
35
+ "gitHead": "9e43f6a450f6c38a5147502863d1f44738fcecef",
36
36
  "scripts": {
37
37
  "types": "tsc --noEmit types/index.d.ts"
38
38
  },
package/types/index.d.ts CHANGED
@@ -110,15 +110,15 @@ export function asFunction<T>(
110
110
  /**
111
111
  * Clones the supplied value.
112
112
  */
113
- export function clone<T>(arg: T, options?: {
113
+ export function clone<T>(value: T, options?: {
114
114
  /**
115
- * Wether to clone the value shallowly.
115
+ * Whether to clone the value shallowly.
116
116
  *
117
117
  * @default false
118
118
  */
119
119
  shallow?: boolean,
120
120
  /**
121
- * Wether to clone all object properties, or only those that are defined
121
+ * Whether to clone all object properties, or only those that are defined
122
122
  * directly on that object, and are not inherited from the object's prototype.
123
123
  *
124
124
  * @default true
@@ -132,7 +132,7 @@ export function clone<T>(arg: T, options?: {
132
132
  /**
133
133
  * Optional callback to process the cloned value.
134
134
  */
135
- processValue?: <S>(arg: T) => S,
135
+ processValue?: <S>(value: T) => S,
136
136
  }): T
137
137
 
138
138
  /**
@@ -214,10 +214,25 @@ export function mapValues<T extends Dictionary<any>, K>(
214
214
  callback?: (value: T[keyof T], key: keyof T, object: T) => K
215
215
  ): Record<keyof T, K>
216
216
 
217
+ /* -------------------------------- promise -------------------------------- */
218
+
219
+ export function mapConcurrently<T, R>(
220
+ input: Promise<T[]> | T[],
221
+ callback: (value: T, index: number, array: T[]) => Promise<R> | R,
222
+ options?: {
223
+ concurrency?: number;
224
+ }
225
+ ): Promise<R[]>;
226
+
227
+ export function mapSequentially<T, R>(
228
+ input: Promise<T[]> | T[],
229
+ callback: (value: T, index: number) => Promise<R> | R
230
+ ): Promise<R[]>;
231
+
217
232
  /* --------------------------------- string --------------------------------- */
218
233
 
219
234
  /**
220
- * Converts a string seperated by spaces, dashes and underscores to camel-case
235
+ * Converts a string separated by spaces, dashes and underscores to camel-case
221
236
  * (`'camelCase'`) or optionally pascal-case (`'CamelCase'`).
222
237
  */
223
238
  export function camelize(str: string, pascalCase?: boolean): string
@@ -226,20 +241,20 @@ export function camelize(str: string, pascalCase?: boolean): string
226
241
  */
227
242
  export function capitalize(str: string): string
228
243
  /**
229
- * Convert a string from camel-case to a string seperated by spaces or a
230
- * supplied seperator string.
244
+ * Convert a string from camel-case to a string separated by spaces or a
245
+ * supplied separator string.
231
246
  *
232
247
  * @param str The string to decamelize.
233
- * @param {string} [sep=' '] - The string to seperate the decamelized words
248
+ * @param {string} [sep=' '] - The string to separate the decamelized words
234
249
  * with.
235
250
  */
236
251
  export function decamelize(str: string, sep?: string): string
237
252
  /**
238
- * Converts a camelized string to a string seperated by dashes.
253
+ * Converts a camelized string to a string separated by dashes.
239
254
  */
240
255
  export function hyphenate(str: string): string
241
256
  /**
242
- * Converts a camelized string to a string seperated by underscores.
257
+ * Converts a camelized string to a string separated by underscores.
243
258
  */
244
259
  export function underscore(str: string): string
245
260
  /**