express-ext 0.4.5 → 0.4.6

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/lib/index.js CHANGED
@@ -387,7 +387,7 @@ function escape(obj) {
387
387
  return obj
388
388
  }
389
389
  exports.escape = escape
390
- function escapeArray(arrs) {
390
+ function escapeArray(arrs, offset, name) {
391
391
  if (!arrs) {
392
392
  return arrs
393
393
  }
@@ -397,6 +397,12 @@ function escapeArray(arrs) {
397
397
  escape(obj)
398
398
  }
399
399
  }
400
+ if (offset && name) {
401
+ var l = arrs.length
402
+ for (var i = 0; i < l; i++) {
403
+ arrs[i][name] = offset + i + 1
404
+ }
405
+ }
400
406
  return arrs
401
407
  }
402
408
  exports.escapeArray = escapeArray
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-ext",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "express-ext",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -370,7 +370,7 @@ export function escape(obj: any): any {
370
370
  }
371
371
  return obj
372
372
  }
373
- export function escapeArray<T>(arrs: T[]): T[] {
373
+ export function escapeArray<T>(arrs: T[], offset?: number, name?: string): T[] {
374
374
  if (!arrs) {
375
375
  return arrs
376
376
  }
@@ -379,6 +379,12 @@ export function escapeArray<T>(arrs: T[]): T[] {
379
379
  escape(obj)
380
380
  }
381
381
  }
382
+ if (offset && name) {
383
+ const l = arrs.length
384
+ for (let i = 0; i < l; i++) {
385
+ ;(arrs[i] as any)[name] = offset + i + 1
386
+ }
387
+ }
382
388
  return arrs
383
389
  }
384
390