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

Function _splitAt

packages/compiler/src/util.ts:25–33  ·  view source on GitHub ↗
(
  input: string,
  character: string,
  defaultValues: (string | null)[],
)

Source from the content-addressed store, hash-verified

23}
24
25function _splitAt(
26 input: string,
27 character: string,
28 defaultValues: (string | null)[],
29): (string | null)[] {
30 const characterIndex = input.indexOf(character);
31 if (characterIndex == -1) return defaultValues;
32 return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
33}
34
35export function noUndefined<T>(val: T | undefined): T {
36 return val === undefined ? null! : val;

Callers 2

splitAtColonFunction · 0.85
splitAtPeriodFunction · 0.85

Calls 2

indexOfMethod · 0.80
sliceMethod · 0.65

Tested by

no test coverage detected