https://github.com/angular/angular
Raw File
Tip revision: f1a2816ba9432b3bf186c94e5f538d72d992dca4 authored by Andrew Kushnir on 06 April 2022, 15:58:29 UTC
release: cut the v14.0.0-next.11 release (#45550)
Tip revision: f1a2816
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