https://github.com/angular/angular
Raw File
Tip revision: cbfe6284a2cb4a0e5f8d88f833de7341d478250d authored by Jessica Janiuk on 13 April 2022, 18:27:48 UTC
release: cut the v13.3.3 release (#45614)
Tip revision: cbfe628
style_url_resolver.ts
/**
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

// Some of the code comes from WebComponents.JS
// https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js

export function isStyleUrlResolvable(url: string|null): url is string {
  if (url == null || url.length === 0 || url[0] == '/') return false;
  const schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
  return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';
}

const URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
back to top