jails-js 5.8.2 → 5.8.4
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/jails.js +1 -1
- package/dist/jails.js.map +1 -1
- package/html.ts +32 -0
- package/package.json +1 -1
- package/src/component.ts +1 -1
- package/src/element.ts +4 -4
- package/src/index.ts +1 -1
- package/src/utils/index.ts +0 -34
- package/src/utils/idiomorph.ts +0 -879
package/src/utils/index.ts
CHANGED
@@ -19,7 +19,6 @@ export const uuid = () => {
|
|
19
19
|
})
|
20
20
|
}
|
21
21
|
|
22
|
-
|
23
22
|
export const dup = (o) => {
|
24
23
|
return JSON.parse(JSON.stringify(o))
|
25
24
|
}
|
@@ -47,36 +46,3 @@ export const purge = (d) => {
|
|
47
46
|
export const safe = (execute, val) => {
|
48
47
|
try{return execute()}catch(err){return val || ''}
|
49
48
|
}
|
50
|
-
|
51
|
-
// From
|
52
|
-
// https://2ality.com/2015/01/template-strings-html.html#comment-2078932192
|
53
|
-
export const html = (literalSections, ...substs) => {
|
54
|
-
|
55
|
-
// Use raw literal sections: we don’t want
|
56
|
-
// backslashes (\n etc.) to be interpreted
|
57
|
-
let raw = literalSections.raw
|
58
|
-
|
59
|
-
let result = ''
|
60
|
-
|
61
|
-
substs.forEach((subst, i) => {
|
62
|
-
// Retrieve the literal section preceding
|
63
|
-
// the current substitution
|
64
|
-
let lit = raw[i]
|
65
|
-
|
66
|
-
// In the example, map() returns an array:
|
67
|
-
// If substitution is an array (and not a string),
|
68
|
-
// we turn it into a string
|
69
|
-
if (Array.isArray(subst)) {
|
70
|
-
subst = subst.join('')
|
71
|
-
}
|
72
|
-
|
73
|
-
result += lit
|
74
|
-
result += subst
|
75
|
-
})
|
76
|
-
// Take care of last literal section
|
77
|
-
// (Never fails, because an empty template string
|
78
|
-
// produces one literal section, an empty string)
|
79
|
-
result += raw[raw.length-1] // (A)
|
80
|
-
|
81
|
-
return result
|
82
|
-
}
|