Skip to content

Commit 829987c

Browse files
authored
Merge pull request #3 from shaunwarman/add-dev-default
fix: default non path options to false
2 parents d3b0dcc + 57e75ff commit 829987c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: node_js
22
node_js:
3-
- '8'
3+
- '12'
4+
- 'lts/*'
5+
- 'node'
46
after_success:
57
npm run coverage

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const PROD = process.env.NODE_ENV === 'production';
2-
31
module.exports = function(opts) {
2+
const PROD = process.env.NODE_ENV === 'production';
3+
44
if (typeof opts !== 'object') {
55
throw new TypeError('`options` argument required');
66
}
@@ -29,7 +29,8 @@ module.exports = function(opts) {
2929
output = opts.prepend + String(manifest[str] || str);
3030
} else if (typeof manifest[str] === 'object') {
3131
const val = String((manifest[str] && manifest[str][prop]) || str);
32-
output = prop === 'path' ? opts.prepend + val : val;
32+
if (prop === 'path') return opts.prepend + val;
33+
output = PROD ? val : false;
3334
}
3435
} catch (err) {}
3536

test/test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ test('returns output of integrity when manifest invoked with old format', t => {
7575

7676
test('returns output of integrity when manifest invoked with new format', t => {
7777
const manifest = path.join(__dirname, 'fixtures', 'rev-manifest.json');
78-
t.is(
79-
manifestRev({ manifest })('script.js', 'integrity'),
80-
'sha256-YEWYfCFP9yc5DAF8K5AtLEyFuKZ1MNw+xQPm8g70LYY='
81-
);
78+
t.is(manifestRev({ manifest })('script.js', 'integrity'), false);
8279
});
8380

8481
test('returns output of integrity when manifest invoked in PROD with old format', t => {

0 commit comments

Comments
 (0)