MCPcopy Create free account
hub / github.com/angular/angular / unescapeQuotes

Function unescapeQuotes

packages/compiler/src/shadow_css.ts:1280–1282  ·  view source on GitHub ↗

* Unescape all quotes present in a string, but only if the string was actually already * quoted. * * This generates a "canonical" representation of strings which can be used to match strings * which would otherwise only differ because of differently escaped quotes. * * For example it converts

(str: string, isQuoted: boolean)

Source from the content-addressed store, hash-verified

1278 * @returns the string in the "canonical" representation without escaped quotes.
1279 */
1280function unescapeQuotes(str: string, isQuoted: boolean): string {
1281 return !isQuoted ? str : str.replace(/((?:^|[^\\])(?:\\\\)*)\\(?=['"])/g, '$1');
1282}
1283
1284/**
1285 * Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`

Callers 2

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected