express-ext 0.4.9 → 0.4.10

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
@@ -361,6 +361,14 @@ function escapeHTML(input) {
361
361
  })
362
362
  }
363
363
  exports.escapeHTML = escapeHTML
364
+ function generateChip(v) {
365
+ return '<div class="chip">' + escapeHTML(v) + '<span class="close" onclick="removeChip(event)"></span></div>'
366
+ }
367
+ exports.generateChip = generateChip
368
+ function generateChips(v) {
369
+ return !v ? "" : "" + v.map(generateChip).join("")
370
+ }
371
+ exports.generateChips = generateChips
364
372
  var s = "string"
365
373
  var o = "object"
366
374
  function escape(obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-ext",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "express-ext",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -345,6 +345,12 @@ export function escapeHTML(input: string): string {
345
345
  return map[char]
346
346
  })
347
347
  }
348
+ export function generateChip(v: string): string {
349
+ return `<div class="chip">${escapeHTML(v)}<span class="close" onclick="removeChip(event)"></span></div>`
350
+ }
351
+ export function generateChips(v?: string[] | null): string {
352
+ return !v ? "" : `${v.map(generateChip).join("")}`
353
+ }
348
354
 
349
355
  const s = "string"
350
356
  const o = "object"