Skip to content

Detect es6 classes via toString starting with word 'class'#41

Merged
YarnSaw merged 4 commits intomainfrom
slightly-improved-determining-js-classes
Mar 13, 2026
Merged

Detect es6 classes via toString starting with word 'class'#41
YarnSaw merged 4 commits intomainfrom
slightly-improved-determining-js-classes

Conversation

@YarnSaw
Copy link
Contributor

@YarnSaw YarnSaw commented Mar 12, 2026

In dcp-client, the BankAccountKeystore class extends the Keystore class, but doesn't add any own properties to the class prototype. Thus, it was detected as a function, not a class originally. This change can fairly reliably detect all es6 classes (but will not detect any es5 classes). Run both detection methods for improved detection overall.

add space to es6 class check

Co-authored-by: Will Pringle <will@distributive.network>
@wiwichips
Copy link
Collaborator

LGTM

@wiwichips
Copy link
Collaborator

still LGTM 😎

@YarnSaw YarnSaw merged commit 024c7fa into main Mar 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants