MCPcopy Index your code
hub / github.com/react/create-react-app / count

Function count

packages/react-error-overlay/src/utils/unmapper.js:14–26  ·  view source on GitHub ↗
(search: string, string: string)

Source from the content-addressed store, hash-verified

12import path from 'path';
13
14function count(search: string, string: string): number {
15 // Count starts at -1 because a do-while loop always runs at least once
16 let count = -1,
17 index = -1;
18 do {
19 // First call or the while case evaluated true, meaning we have to make
20 // count 0 or we found a character
21 ++count;
22 // Find the index of our search string, starting after the previous index
23 index = string.indexOf(search, index + 1);
24 } while (index !== -1);
25 return count;
26}
27
28/**
29 * Turns a set of mapped <code>StackFrame</code>s back into their generated code position and enhances them with code.

Callers 1

unmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected