UNPKG

685 BJavaScriptView Raw
1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9const errors = require('./errors');
10
11module.exports = (regexp) => {
12 if (!(regexp instanceof RegExp)) {
13 throw new Error(errors['invalid-dont-cache-bust']);
14 }
15
16 return (originalManifest) => {
17 const manifest = originalManifest.map((entry) => {
18 if (typeof entry.url !== 'string') {
19 throw new Error(errors['manifest-entry-bad-url']);
20 }
21
22 if (entry.url.match(regexp)) {
23 delete entry.revision;
24 }
25
26 return entry;
27 });
28
29 return {manifest};
30 };
31};