MCPcopy
hub / github.com/formatjs/formatjs / bumpIf

Method bumpIf

packages/icu-messageformat-parser/parser.ts:1187–1195  ·  view source on GitHub ↗

* If the substring starting at the current position of the parser has * the given prefix, then bump the parser to the character immediately * following the prefix and return true. Otherwise, don't bump the parser * and return false.

(prefix: string)

Source from the content-addressed store, hash-verified

1185 * and return false.
1186 */
1187 private bumpIf(prefix: string): boolean {
1188 if (this.message.startsWith(prefix, this.offset())) {
1189 for (let i = 0; i < prefix.length; i++) {
1190 this.bump()
1191 }
1192 return true
1193 }
1194 return false
1195 }
1196
1197 /**
1198 * Bump the parser until the pattern character is found and return `true`.

Callers 4

parseTagMethod · 0.95
parseArgumentOptionsMethod · 0.95

Calls 2

offsetMethod · 0.95
bumpMethod · 0.95

Tested by

no test coverage detected