Skip to content

Commit

Permalink
fix: do not access prototype
Browse files Browse the repository at this point in the history
NOTE: I could on reproduce this as an issue in Android StrictMode (not JS or React StrictMode)

fixes #239
  • Loading branch information
6utt3rfly committed Jul 6, 2024
1 parent 72e0458 commit 037d1db
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/jsep.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,11 @@ Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);

// Backward Compatibility:
const jsep = expr => (new Jsep(expr)).parse();
const staticMethods = Object.getOwnPropertyNames(Jsep);
staticMethods
const stdClassProps = Object.getOwnPropertyNames(class Test{});
Object.getOwnPropertyNames(Jsep)
.filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined)
.forEach((m) => {
if (jsep[m] === undefined && m !== 'prototype') {
jsep[m] = Jsep[m];
}
jsep[m] = Jsep[m];
});
jsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');
export default jsep;
Expand Down

0 comments on commit 037d1db

Please sign in to comment.