HomePhabricator
Diffusion Comm 5423a97b4deb

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

Description

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

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)

Reviewers: ginsu, atul

Reviewed By: atul

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8146

Details

Provenance
ashoatAuthored on Jun 7 2023, 10:50 AM
Reviewer
atul
Differential Revision
D8146: [lib] Use RegExp.source instead of RegExp.toString() in emojis.js
Parents
rCOMM746427b642ba: [lib] Make sure all default emojis pass onlyOneEmojiRegex
Branches
Unknown
Tags
Unknown