Pass undefined instead of an empty string

pull/5082/head
lukasmoellerch 5 years ago
parent 0b07be410d
commit b7a153f88c

@ -95,7 +95,7 @@ export default async function preprocess(
source = await replace_async( source = await replace_async(
source, source,
/<!--[^]*?-->|<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi, /<!--[^]*?-->|<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi,
async (match, attributes = '', content = '') => { async (match, attributes = '', content) => {
if (!attributes && !content) { if (!attributes && !content) {
return match; return match;
} }
@ -115,7 +115,7 @@ export default async function preprocess(
source = await replace_async( source = await replace_async(
source, source,
/<!--[^]*?-->|<style(\s[^]*?)?(?:>([^]*?)<\/style>|\/>)/gi, /<!--[^]*?-->|<style(\s[^]*?)?(?:>([^]*?)<\/style>|\/>)/gi,
async (match, attributes = '', content = '') => { async (match, attributes = '', content) => {
if (!attributes && !content) { if (!attributes && !content) {
return match; return match;
} }

@ -3,7 +3,7 @@ import * as assert from "assert";
export default { export default {
preprocess: { preprocess: {
script: ({ content, attributes }) => { script: ({ content, attributes }) => {
assert.equal(content, ""); assert.equal(content, undefined);
return { return {
code: `console.log("${attributes["the-answer"]}");` code: `console.log("${attributes["the-answer"]}");`
}; };

@ -3,7 +3,7 @@ import * as assert from "assert";
export default { export default {
preprocess: { preprocess: {
style: ({ content, attributes: { color } }) => { style: ({ content, attributes: { color } }) => {
assert.equal(content, ""); assert.equal(content, undefined);
return { return {
code: `div { color: ${color}; }` code: `div { color: ${color}; }`
}; };

Loading…
Cancel
Save