function (?[a-zA-Z0-9]+)\s*(?([^()])(?::\s[^{}\s])?)\s(?{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}]}[^\r{}])}[^\r{}])}[^\r{}])}[^\r{}])}[^\r{}])})(?:;)?
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
Top comments (10)
const isArrowFn = (fn) =>
(typeof fn === 'function') &&
!/^(?:(?:\/*[^(?:*\/)]*\/\s)|(?:\/\/[^\r\n]))\s*(?:(?:(?:async\s(?:(?:\/*[^(?:*\/)]*\/\s)|(?:\/\/[^\r\n]))\s*)?function|class)(?:\s|(?:(?:\/*[^(?:*\/)]*\/\s)|(?:\/\/[^\r\n])))|(?:[$\w][\w0-9$]\s(?:\/*[^(?:*\/)]*\/\s)\s()|(?:[\s*(?:\/*[^(?:*\/)]*\/\s)\s(?:(?:['][^']+['])|(?:["][^"]+["]))\s*(?:\/*[^(?:*\/)]*\/\s)\s]())/.test(fn.toString());
function (?[a-zA-Z0-9]+)\s*(?([^()])(?::\s[^{}\s])?)\s(?{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}](?:{[^\r{}]}[^\r{}])}[^\r{}])}[^\r{}])}[^\r{}])}[^\r{}])})(?:;)?
Working fine..
([=]) (([\w\s].*[\w\s])|()) =>
/(([\w\s].*[\w\s])|()) =>/gmi
(([\w\s].*[\w\s])|()) =>
what are you doing here exactly?
*whispering: shhhhh, can't you see he's thinking out loud? π
The question is why you need regex? What is the use case. You may be better with using JavaScript parser like Esprima.