File tree 4 files changed +41
-3
lines changed
4 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ const cli = meow(`
8
8
$ slugify <string>
9
9
10
10
Options
11
- --separator=<string> Word separator [Default: -]
11
+ --separator=<string> Word separator [Default: -]
12
+ --no-lowercase Don’t make the slug lowercase
13
+ --no-decamelize Don’t convert camelCase to separate words
14
+ --preserve-leading-underscore If your string starts with an underscore, it will be preserved in the slugified string
12
15
13
16
Examples
14
17
$ slugify 'Déjà Vu!'
@@ -19,6 +22,18 @@ const cli = meow(`
19
22
flags : {
20
23
separator : {
21
24
type : 'string'
25
+ } ,
26
+ lowercase : {
27
+ type : 'boolean' ,
28
+ default : true
29
+ } ,
30
+ decamelize : {
31
+ type : 'boolean' ,
32
+ default : true
33
+ } ,
34
+ preserveLeadingUnderscore : {
35
+ type : 'boolean' ,
36
+ default : false
22
37
}
23
38
}
24
39
} ) ;
Original file line number Diff line number Diff line change 43
43
" id"
44
44
],
45
45
"dependencies" : {
46
- "@sindresorhus/slugify" : " ^0.6 .0" ,
46
+ "@sindresorhus/slugify" : " ^0.11 .0" ,
47
47
"meow" : " ^5.0.0"
48
48
},
49
49
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -19,7 +19,10 @@ $ slugify --help
19
19
$ slugify <string>
20
20
21
21
Options
22
- --separator=<string> Word separator [Default: -]
22
+ --separator=<string> Word separator [Default: -]
23
+ --no-lowercase Don’t make the slug lowercase
24
+ --no-decamelize Don’t convert camelCase to separate words
25
+ --preserve-leading-underscore If your string starts with an underscore, it will be preserved in the slugified string
23
26
24
27
Examples
25
28
$ slugify 'Déjà Vu!'
Original file line number Diff line number Diff line change @@ -5,3 +5,23 @@ test('main', async t => {
5
5
const { stdout} = await execa ( './cli.js' , [ 'Déjà Vu!' ] ) ;
6
6
t . is ( stdout , 'deja-vu' ) ;
7
7
} ) ;
8
+
9
+ test ( 'separator' , async t => {
10
+ const { stdout} = await execa ( './cli.js' , [ 'Unicorns & Rainbows' , '--separator=_' ] ) ;
11
+ t . is ( stdout , 'unicorns_and_rainbows' ) ;
12
+ } ) ;
13
+
14
+ test ( 'lowercase' , async t => {
15
+ const { stdout} = await execa ( './cli.js' , [ 'Déjà Vu!' , '--no-lowercase' ] ) ;
16
+ t . is ( stdout , 'Deja-Vu' ) ;
17
+ } ) ;
18
+
19
+ test ( 'decamelize' , async t => {
20
+ const { stdout} = await execa ( './cli.js' , [ 'fooBar' , '--no-decamelize' ] ) ;
21
+ t . is ( stdout , 'foobar' ) ;
22
+ } ) ;
23
+
24
+ test ( 'preserve-leading-underscore' , async t => {
25
+ const { stdout} = await execa ( './cli.js' , [ '_foo_bar' , '--preserve-leading-underscore' ] ) ;
26
+ t . is ( stdout , '_foo-bar' ) ;
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments