Fix test error #1297

This commit is contained in:
Yuta Nakayama 2025-02-28 19:13:46 +08:00 committed by GitHub
parent c0b3187029
commit 7c1e968d41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,9 @@
const ALLOW_MANY = ['by', 'url', 'genre', 'license'];
import { defaultCode } from './user_pattern_utils.mjs';
export function getMetadata(raw_code) {
if (raw_code == null) {
console.error('could not extract metadata from missing pattern code');
raw_code = defaultCode;
raw_code = '';
}
const comment_regexp = /\/\*([\s\S]*?)\*\/|\/\/(.*)$/gm;
const comments = [...raw_code.matchAll(comment_regexp)].map((c) => (c[1] || c[2] || '').trim());