/ proof-of-concept / audio-spike-sorting
Sign in
proof-of-concept / audio-spike-sorting
audio-spike-sorting / src / bench / source.ts
7 lines · 349 BBlameHistoryRaw
1/** Kept free of any numbl import so the main thread can use it. */
3/** Name of the first function defined in a .m source, or null for a plain script. */
4export function extractFunctionName(source: string): string | null {
5 const m = source.match(/^\s*function\s+(?:\[[^\]]*\]\s*=\s*|\w+\s*=\s*)?([A-Za-z]\w*)\s*\(/m);
6 return m ? m[1] : null;
7}
↑↓ move↵openescclose