Page MenuHomePhabricator

[lib] Use RegExp.source instead of RegExp.toString() in emojis.js
ClosedPublic

Authored by ashoat on Jun 7 2023, 12:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 4, 8:27 PM
Unknown Object (File)
Thu, Apr 4, 8:27 PM
Unknown Object (File)
Thu, Apr 4, 8:26 PM
Unknown Object (File)
Thu, Apr 4, 8:25 PM
Unknown Object (File)
Feb 24 2024, 10:07 AM
Unknown Object (File)
Feb 24 2024, 10:07 AM
Unknown Object (File)
Feb 24 2024, 10:07 AM
Unknown Object (File)
Feb 24 2024, 10:05 AM
Subscribers

Details

Summary

RegExp.toString() returns a string that includes / at the start and /g at the end, which forces us to parse the resultant string. We do this currently with another RegExp.

However, RegExp.source doesn't include those things. By using this property we can skip the parsing step.

Depends on D8145

Test Plan

Unit tests and comparing the generated RegExp object before and after the change to make sure they match (in Chrome debugger)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable