@cabloy/utils 2.0.12 → 2.0.13

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.js CHANGED
@@ -241,6 +241,28 @@ function stringLazy(fn) {
241
241
  toString: fn
242
242
  };
243
243
  }
244
+ async function forEach(arr, order, fn) {
245
+ if (order) {
246
+ for (let index = 0; index < arr.length; index++) {
247
+ await fn(arr[index], index);
248
+ }
249
+ } else {
250
+ for (let index = arr.length - 1; index >= 0; index--) {
251
+ await fn(arr[index], index);
252
+ }
253
+ }
254
+ }
255
+ function forEachSync(arr, order, fn) {
256
+ if (order) {
257
+ for (let index = 0; index < arr.length; index++) {
258
+ fn(arr[index], index);
259
+ }
260
+ } else {
261
+ for (let index = arr.length - 1; index >= 0; index--) {
262
+ fn(arr[index], index);
263
+ }
264
+ }
265
+ }
244
266
 
245
267
  const celEnvBase = new Environment({
246
268
  unlistedVariablesAreDyn: true,
@@ -474,4 +496,4 @@ function zodCustomError(path, message) {
474
496
  return error;
475
497
  }
476
498
 
477
- export { StringPrefixCel, StringPrefixRaw, StringPrefixRegexp, addLeadingSlash, catchError, catchErrorSync, cel, celEnvBase, checkMeta, combineApiPath, combineApiPathControllerAndAction, combineApiPathControllerAndActionRaw, combineParamsAndQuery, combineQueries, combineResourceName, combineResourceNameParts, createFunction, defaultPathSerializer, deprecated, ensureArray, evaluate, evaluateExpressions, evaluateSimple, getProperty, getPropertyObject, getRandomInt, hasProperty, hashkey, isClass, isClassStrict, isConstructor, isEmpty, isEmptyObject, isFunction, isNil, isNilOrEmptyString, isNumber, isObject, isPlainObject, isPromise, isString, isSymbol, isUndefined, matchSelector, normalizePath, parse, raw, regexp, replaceTemplate, safeBoolean, setProperty, sleep, stringLazy, stripEndSlash, zodCustomError };
499
+ export { StringPrefixCel, StringPrefixRaw, StringPrefixRegexp, addLeadingSlash, catchError, catchErrorSync, cel, celEnvBase, checkMeta, combineApiPath, combineApiPathControllerAndAction, combineApiPathControllerAndActionRaw, combineParamsAndQuery, combineQueries, combineResourceName, combineResourceNameParts, createFunction, defaultPathSerializer, deprecated, ensureArray, evaluate, evaluateExpressions, evaluateSimple, forEach, forEachSync, getProperty, getPropertyObject, getRandomInt, hasProperty, hashkey, isClass, isClassStrict, isConstructor, isEmpty, isEmptyObject, isFunction, isNil, isNilOrEmptyString, isNumber, isObject, isPlainObject, isPromise, isString, isSymbol, isUndefined, matchSelector, normalizePath, parse, raw, regexp, replaceTemplate, safeBoolean, setProperty, sleep, stringLazy, stripEndSlash, zodCustomError };
package/dist/utils.d.ts CHANGED
@@ -18,3 +18,5 @@ export declare function ensureArray(arr: any, sep?: string): any[] | undefined;
18
18
  export declare function stringLazy(fn: () => string): {
19
19
  toString: () => string;
20
20
  };
21
+ export declare function forEach<T>(arr: T[], order: boolean, fn: (item: T, index: number) => Promise<void>): Promise<void>;
22
+ export declare function forEachSync<T>(arr: T[], order: boolean, fn: (item: T, index: number) => void): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cabloy/utils",
3
3
  "type": "module",
4
- "version": "2.0.12",
4
+ "version": "2.0.13",
5
5
  "description": "cabloy utils",
6
6
  "publishConfig": {
7
7
  "access": "public"