Refactor: buildMeta

This commit is contained in:
eight 2017-11-09 08:49:10 +08:00
parent a1b818f0c5
commit 09e7d67dd2

View File

@ -110,12 +110,6 @@ var usercss = (() => {
} }
} }
function buildMeta(source) {
const style = _buildMeta(source);
validate(style);
return style;
}
function parseWord(state, error = 'invalid word') { function parseWord(state, error = 'invalid word') {
const match = state.text.slice(state.re.lastIndex).match(/^([\w-]+)\s*/); const match = state.text.slice(state.re.lastIndex).match(/^([\w-]+)\s*/);
if (!match) { if (!match) {
@ -344,7 +338,7 @@ var usercss = (() => {
return s; return s;
} }
function _buildMeta(sourceCode) { function buildMeta(sourceCode) {
sourceCode = sourceCode.replace(/\r\n?/g, '\n'); sourceCode = sourceCode.replace(/\r\n?/g, '\n');
const usercssData = { const usercssData = {
@ -391,6 +385,8 @@ var usercss = (() => {
style.url = usercssData.homepageURL; style.url = usercssData.homepageURL;
} }
validate(style);
return style; return style;
} }