Skip to content

Commit 60418c5

Browse files
committed
bug fix
1 parent cd01a98 commit 60418c5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function createGenerator(pattern, options) {
1616
var context = options && typeof options.context === 'string'
1717
? options.context
1818
: '';
19-
var hashPrefix = options && typeof options.hashPrefix
19+
var hashPrefix = options && typeof options.hashPrefix === 'string'
2020
? options.hashPrefix
2121
: '';
2222

test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ describe('generic-names', function () {
66

77
it('should use cwd if no context provided', function () {
88
var generate = genericNames('[name]__[local]___[hash:base64:5]');
9-
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___2bpA4');
9+
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___2e670');
1010
});
1111

1212
it('should generate another hash for the provided context', function () {
1313
var generate = genericNames('[name]__[local]___[hash:base64:5]', {context: '/test'});
14-
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___CEQPZ');
14+
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___19xFw');
15+
});
16+
17+
it('should generate another hash for the provided hashPrefix', function () {
18+
var generate = genericNames('[name]__[local]___[hash:base64:5]', {context: '/test', hashPrefix: '--'});
19+
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___3T0Un');
1520
});
1621
});

0 commit comments

Comments
 (0)