Skip to content

Commit

Permalink
perf(*): use to-case module, close #35
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Demidov committed Jan 9, 2017
1 parent f522b9f commit 303f19c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"log-symbols": "^1.0.2",
"post-config": "0.0.4-alpha.2",
"post-sequence": "^0.1.10",
"text-table": "^0.2.0"
"text-table": "^0.2.0",
"to-slug-case": "^1.0.0"
},
"devDependencies": {
"autoprefixer": "^6.6.0",
Expand Down
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import logSymbols from 'log-symbols';
import chalk from 'chalk';
import table from 'text-table';
import indentString from 'indent-string';
import toSlugCase from 'to-slug-case';

chalk.enabled = true;

const toKebabCase = plugin => plugin.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`);
const getModuleName = plugin => `${toKebabCase(plugin)}`;

const loadPlugin = (plugin, warning) => {
try {
return require(getModuleName(plugin));
return require(toSlugCase(plugin));
} catch (err) {
warning.push(Array.of(indentString(`${chalk.red(logSymbols.error)}`, 4), plugin));
return () => {};
Expand Down

0 comments on commit 303f19c

Please sign in to comment.