From 09e7d67dd286588fcf8c69f445909604af844fd2 Mon Sep 17 00:00:00 2001 From: eight Date: Thu, 9 Nov 2017 08:49:10 +0800 Subject: [PATCH] Refactor: buildMeta --- js/usercss.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/js/usercss.js b/js/usercss.js index b6ab0872..1f4d88ce 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -110,12 +110,6 @@ var usercss = (() => { } } - function buildMeta(source) { - const style = _buildMeta(source); - validate(style); - return style; - } - function parseWord(state, error = 'invalid word') { const match = state.text.slice(state.re.lastIndex).match(/^([\w-]+)\s*/); if (!match) { @@ -344,7 +338,7 @@ var usercss = (() => { return s; } - function _buildMeta(sourceCode) { + function buildMeta(sourceCode) { sourceCode = sourceCode.replace(/\r\n?/g, '\n'); const usercssData = { @@ -391,6 +385,8 @@ var usercss = (() => { style.url = usercssData.homepageURL; } + validate(style); + return style; }