Skip to content

Instantly share code, notes, and snippets.

@jonesnxt
Last active October 21, 2022 00:01
Show Gist options
  • Save jonesnxt/950afb38f308ea68095143f243da64e2 to your computer and use it in GitHub Desktop.
Save jonesnxt/950afb38f308ea68095143f243da64e2 to your computer and use it in GitHub Desktop.
S('MemberExpression').each((expression) => {
const [name, index] = expression.children().map((child) => child.text());
const nameDotLength = `${name}.length`;
if (!index.startsWith(nameDotLength)) return;
expression.text(`${name}.at(${index.slice(nameDotLength.length)})`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment