Skip to content

Commit e2bf50b

Browse files
authored
Merge pull request #15 from msfragala/use-pascal-case
Change default name from snake_case to PascalCase
2 parents c44a80d + c2256a8 commit e2bf50b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"acorn-jsx": "4.1.0",
3636
"asyncro": "^2.0.1",
3737
"babel-polyfill": "^6.26.0",
38+
"camelcase": "^4.1.0",
3839
"chalk": "^2.3.0",
3940
"es6-promisify": "^5.0.0",
4041
"glob": "^7.1.2",

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import gzipSize from 'gzip-size';
1616
import prettyBytes from 'pretty-bytes';
1717
import shebangPlugin from 'rollup-plugin-preserve-shebang';
1818
import flow from 'rollup-plugin-flow';
19+
import camelCase from 'camelcase';
1920

2021
const readFile = promisify(fs.readFile);
2122
const stat = promisify(fs.stat);
2223
const isDir = name => stat(name).then( stats => stats.isDirectory() ).catch( () => false );
2324
const isFile = name => stat(name).then( stats => stats.isFile() ).catch( () => false );
24-
const safeVariableName = name => name.replace(/(?:^[^a-z$_]|([^a-z0-9_$]+))/g, '_');
25+
const safeVariableName = name => camelCase(name.toLowerCase().replace(/((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g, ''));
2526

2627
const FORMATS = ['es', 'cjs', 'umd'];
2728

0 commit comments

Comments
 (0)