mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Match results record their metadata lazily. The results of one exec or matchAll call share a source (the subject and the regex), and each result keeps its start index. index, input and a null-prototype groups object are built when a result is converted to a dynamic value; .index and .input on a match slice read the source directly. matchAll rows are allocated inline, like exec results. A drain whose rows are read only through their elements, .length, the .groups projection and the companion index uses matchAllCaptures or matchAllCapturesInto, whose rows carry no metadata.