UNPKG

@spartacus/core

Version:

Spartacus - the core framework

37 lines (36 loc) 1.71 kB
/** * @license * The MIT License * Copyright (c) 2010-2019 Google LLC. http://angular.io/license * * See: * - https://github.com/angular/angular/blob/6f5f481fdae03f1d8db36284b64c7b82d9519d85/packages/service-worker/config/src/glob.ts * - https://github.com/angular/angular/blob/6f5f481fdae03f1d8db36284b64c7b82d9519d85/aio/tests/deployment/shared/helpers.ts#L17 * - https://github.com/angular/angular/blob/6f5f481fdae03f1d8db36284b64c7b82d9519d85/packages/service-worker/config/src/generator.ts#L86 */ /** * Converts the glob-like pattern into regex string. * * Patterns use a limited glob format: * `**` matches 0 or more path segments * `*` matches 0 or more characters excluding `/` * `?` matches exactly one character excluding `/` (but when @param literalQuestionMark is true, `?` is treated as normal character) * The `!` prefix marks the pattern as being negative, meaning that only URLs that don't match the pattern will be included * * @param glob glob-like pattern * @param literalQuestionMark when true, it tells that `?` is treated as a normal character */ export declare function globToRegex(glob: string, literalQuestionMark?: boolean): string; /** * For given list of glob-like patterns, returns a matcher function. * * The matcher returns true for given URL only when ANY of the positive patterns is matched and NONE of the negative ones. */ export declare function getGlobMatcher(patterns: string[]): (url: string) => boolean; /** * Converts list of glob-like patterns into list of RegExps with information whether the glob pattern is positive or negative */ export declare function processGlobPatterns(urls: string[]): { positive: boolean; regex: string; }[];