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)
Sun, Jan 12, 7:36 AM
Unknown Object (File)
Sun, Jan 12, 7:21 AM
Unknown Object (File)
Sun, Jan 12, 7:19 AM
Unknown Object (File)
Sun, Jan 12, 6:58 AM
Unknown Object (File)
Sun, Jan 12, 6:53 AM
Unknown Object (File)
Thu, Dec 26, 3:40 PM
Unknown Object (File)
Dec 15 2024, 1:45 PM
Unknown Object (File)
Dec 15 2024, 1:45 PM
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