Skip to content

camelize double-dashes regex with tests fixed #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transformTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.transformTokens = transformTokens;
* @return {string}
*/
function camelizeDashes(str) {
return str.replace(/-(\w)/g, (m, letter) => letter.toUpperCase());
return str.replace(/-+(\w)/g, (m, letter) => letter.toUpperCase());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/api/camelCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ suite('api/camelCase', () => {
test('should replace keys with dashes by its camel-cased equivalent', () => {
const tokens = require('./fixture/bem.css');
assert.deepEqual(tokens, {
'block__element-Modifier': '_test_api_fixture_bem__block__element--modifier',
'block__elementModifier': '_test_api_fixture_bem__block__element--modifier',
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/api/generateScopedName.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ suite('api/generateScopedName', () => {
let args;
let tokens;

const processor = spy(function (selector, filepath, source) {
const processor = spy((selector, filepath, source) => {
args = [selector, filepath, source];
return selector;
});
Expand Down
2 changes: 1 addition & 1 deletion test/api/hashPrefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const detachHook = require('../sugar').detachHook;
const dropCache = require('../sugar').dropCache;

suite('api/hashPrefix', () => {
let samples = [];
const samples = [];

suite('using string pattern and hashPrefix', () => {
let tokens;
Expand Down