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

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

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

Loading…
Cancel
Save