MCPcopy Index your code
hub / github.com/violentmonkey/violentmonkey / parseMetaWithErrors

Function parseMetaWithErrors

src/background/utils/db.js:597–616  ·  view source on GitHub ↗

* @param {string | {code:string, custom:VMScript['custom']}} src * @return {{ meta: VMScript['meta'], errors: string[] }}

(src)

Source from the content-addressed store, hash-verified

595 * @return {{ meta: VMScript['meta'], errors: string[] }}
596 */
597function parseMetaWithErrors(src) {
598 const isObj = isObject(src);
599 const custom = isObj && src.custom || getDefaultCustom();
600 const errors = [];
601 const meta = parseMeta(isObj ? src.code : src, { errors });
602 if (meta) {
603 if (meta.grant.includes('none') && new Set(meta.grant).size > 1) {
604 errors.push(i18n('hintGrantNone'));
605 }
606 testerBatch(errors);
607 testScript('', { meta, custom });
608 testerBatch();
609 } else {
610 errors.push(i18n('labelNoName')); // used by confirm app
611 }
612 return {
613 meta,
614 errors: errors.length ? errors : null,
615 };
616}
617
618/**
619 * @param {VMScriptSourceOptions} src

Callers 2

db.jsFile · 0.85
parseScriptFunction · 0.85

Calls 5

getDefaultCustomFunction · 0.90
parseMetaFunction · 0.90
testerBatchFunction · 0.90
testScriptFunction · 0.90
isObjectFunction · 0.85

Tested by

no test coverage detected