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, Nov 10, 1:59 PM
Unknown Object (File)
Fri, Nov 1, 3:20 PM
Unknown Object (File)
Sun, Oct 27, 8:19 AM
Unknown Object (File)
Tue, Oct 22, 2:57 PM
Unknown Object (File)
Fri, Oct 18, 9:43 PM
Unknown Object (File)
Fri, Oct 18, 9:43 PM
Unknown Object (File)
Sep 13 2024, 3:22 PM
Unknown Object (File)
Sep 13 2024, 3:22 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