Comparing version 0.0.5 to 0.1.0
@@ -52,2 +52,5 @@ 'use strict' | ||
`} | ||
<p> | ||
attributes: <input type=text value=${''} disabled onclick="${() => alert('hello')}" ${{ title: '<Special " characters>' }} /> | ||
</p> | ||
</div> | ||
@@ -54,0 +57,0 @@ ` |
20
index.js
@@ -26,2 +26,6 @@ 'use strict' | ||
function escape (value) { | ||
return value.toString().replace(replaceMapRE, replaceMapper) | ||
} | ||
function handleValue (value) { | ||
@@ -42,3 +46,3 @@ if (value === null || value === undefined || value === false) { | ||
if (valueType === 'function') { | ||
return '""' | ||
return '' | ||
} | ||
@@ -54,3 +58,3 @@ | ||
return value.toString().replace(replaceMapRE, replaceMapper) | ||
return escape(value) | ||
} | ||
@@ -62,3 +66,9 @@ | ||
for (var i = 0; i < pieces.length - 1; i++) { | ||
output += pieces[i] + handleValue(arguments[i + 1]) | ||
var piece = pieces[i] | ||
var value = handleValue(arguments[i + 1]) | ||
if (piece[piece.length - 1] === '=') { | ||
output += piece + '"' + value + '"' | ||
} else { | ||
output += piece + value | ||
} | ||
} | ||
@@ -82,5 +92,5 @@ output += pieces[i] | ||
for (var i = 0; i < keys.length - 1; i++) { | ||
values += keys[i] + '="' + (obj[keys[i]] || '') + '" ' | ||
values += keys[i] + '="' + escape(obj[keys[i]] || '') + '" ' | ||
} | ||
return values + keys[i] + '="' + (obj[keys[i]] || '') + '"' | ||
return values + keys[i] + '="' + escape(obj[keys[i]] || '') + '"' | ||
} | ||
@@ -87,0 +97,0 @@ |
{ | ||
"name": "pelo", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "Lightning fast server-side rendering with tagged template literals", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -52,2 +52,5 @@ 'use strict' | ||
}) | ||
server.on('listening', () => { | ||
console.log('Listening on', server.address()); | ||
}); | ||
server.listen(8080) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
108751
1152
1
8