express-ext 0.4.5 → 0.4.7

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,10 @@ 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
+ if (offset === void 0) {
392
+ offset = 0
393
+ }
391
394
  if (!arrs) {
392
395
  return arrs
393
396
  }
@@ -397,6 +400,12 @@ function escapeArray(arrs) {
397
400
  escape(obj)
398
401
  }
399
402
  }
403
+ if (name) {
404
+ var l = arrs.length
405
+ for (var i = 0; i < l; i++) {
406
+ arrs[i][name] = offset + i + 1
407
+ }
408
+ }
400
409
  return arrs
401
410
  }
402
411
  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.7",
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 = 0, 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 (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