* @param {string | {code:string, custom:VMScript['custom']}} src * @return {{ meta: VMScript['meta'], errors: string[] }}
(src)
| 595 | * @return {{ meta: VMScript['meta'], errors: string[] }} |
| 596 | */ |
| 597 | function 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 |
no test coverage detected