MCPcopy
hub / github.com/angular/angular / parsePlaceholder

Function parsePlaceholder

packages/localize/src/utils/src/messages.ts:286–297  ·  view source on GitHub ↗
(
  cooked: string,
  raw: string,
)

Source from the content-addressed store, hash-verified

284 * preceding placeholder, along with the static text that follows.
285 */
286export function parsePlaceholder(
287 cooked: string,
288 raw: string,
289): {messagePart: string; placeholderName?: string; associatedMessageId?: string} {
290 const {text: messagePart, block} = splitBlock(cooked, raw);
291 if (block === undefined) {
292 return {messagePart};
293 } else {
294 const [placeholderName, associatedMessageId] = block.split(ID_SEPARATOR);
295 return {messagePart, placeholderName, associatedMessageId};
296 }
297}
298
299/**
300 * Split a message part (`cooked` + `raw`) into an optional delimited "block" off the front and the

Callers 1

parseMessageFunction · 0.85

Calls 1

splitBlockFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…