express-ext 0.4.11 → 0.4.12
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 +12 -4
- package/package.json +1 -1
- package/src/index.ts +5 -4
package/lib/index.js
CHANGED
|
@@ -400,12 +400,20 @@ function escapeHTML(input) {
|
|
|
400
400
|
})
|
|
401
401
|
}
|
|
402
402
|
exports.escapeHTML = escapeHTML
|
|
403
|
-
function generateChip(v) {
|
|
404
|
-
|
|
403
|
+
function generateChip(v, noClose) {
|
|
404
|
+
var s = noClose ? "" : '<span class="close" onclick="removeChip(event)"></span>'
|
|
405
|
+
return '<div class="chip">' + escapeHTML(v) + s + "</div>"
|
|
405
406
|
}
|
|
406
407
|
exports.generateChip = generateChip
|
|
407
|
-
function generateChips(v) {
|
|
408
|
-
return !v
|
|
408
|
+
function generateChips(v, noClose) {
|
|
409
|
+
return !v
|
|
410
|
+
? ""
|
|
411
|
+
: "" +
|
|
412
|
+
v
|
|
413
|
+
.map(function (s) {
|
|
414
|
+
return generateChip(s, noClose)
|
|
415
|
+
})
|
|
416
|
+
.join("")
|
|
409
417
|
}
|
|
410
418
|
exports.generateChips = generateChips
|
|
411
419
|
var s = "string"
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -384,11 +384,12 @@ export function escapeHTML(input: string): string {
|
|
|
384
384
|
return map[char]
|
|
385
385
|
})
|
|
386
386
|
}
|
|
387
|
-
export function generateChip(v: string): string {
|
|
388
|
-
|
|
387
|
+
export function generateChip(v: string, noClose?: boolean): string {
|
|
388
|
+
const s = noClose ? "" : `<span class="close" onclick="removeChip(event)"></span>`
|
|
389
|
+
return `<div class="chip">${escapeHTML(v)}${s}</div>`
|
|
389
390
|
}
|
|
390
|
-
export function generateChips(v?: string[] | null): string {
|
|
391
|
-
return !v ? "" : `${v.map(generateChip).join("")}`
|
|
391
|
+
export function generateChips(v?: string[] | null, noClose?: boolean): string {
|
|
392
|
+
return !v ? "" : `${v.map((s) => generateChip(s, noClose)).join("")}`
|
|
392
393
|
}
|
|
393
394
|
|
|
394
395
|
const s = "string"
|