File tree Expand file tree Collapse file tree 2 files changed +47
-4
lines changed Expand file tree Collapse file tree 2 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 2424 "type" : " module" ,
2525 "scripts" : {
2626 "build" : " esbuild lib/limax.mjs --format=cjs --outfile=lib/limax.cjs" ,
27- "test" : " semistandard lib/limax.mjs && npm run build && nyc --reporter=html ava test/unit.cjs" ,
27+ "lint" : " semistandard lib/limax.mjs" ,
28+ "types" : " tsd --files test/index.test-d.ts" ,
29+ "unit" : " nyc --reporter=html ava test/unit.cjs" ,
30+ "test" : " npm run lint && npm run build && npm run types && npm run unit" ,
2831 "changelog" : " conventional-changelog -i CHANGELOG.md -s"
2932 },
3033 "keywords" : [
5659 "dependencies" : {
5760 "hepburn" : " ^1.2.2" ,
5861 "lodash.deburr" : " ^4.1.0" ,
59- "speakingurl " : " ^14.0.1 " ,
60- "pinyin-pro " : " ^3.27.0 "
62+ "pinyin-pro " : " ^3.27.0 " ,
63+ "speakingurl " : " ^14.0.1 "
6164 },
6265 "devDependencies" : {
6366 "ava" : " ^5.3.1" ,
6467 "conventional-changelog-cli" : " ^2.2.2" ,
6568 "esbuild" : " ^0.25.10" ,
6669 "nyc" : " ^15.1.0" ,
67- "semistandard" : " ^16.0.1"
70+ "semistandard" : " ^16.0.1" ,
71+ "tsd" : " ^0.33.0"
6872 }
6973}
Original file line number Diff line number Diff line change 1+ import limax from '..' ;
2+
3+ const input : string = 'foo bar baz' ;
4+
5+ const slug : string = limax ( input ) ;
6+ const slugWithOptions : string = limax ( input , { separator : '_' , custom : [ '.' ] } ) ;
7+ const slugWithAllOptions : string = limax ( input , {
8+ separator : '_' ,
9+ replacement : '-' ,
10+ maintainCase : true ,
11+ tone : true ,
12+ custom : { 'o' : '0' } ,
13+ lang : 'en' ,
14+ } ) ;
15+ const slugWithLangOnly : string = limax ( input , { lang : 'de' } ) ;
16+
17+ // @ts -expect-error
18+ limax ( 123 ) ;
19+
20+ // @ts -expect-error
21+ limax ( input , { separator : 123 } ) ;
22+
23+ // @ts -expect-error
24+ limax ( input , { replacement : 123 } ) ;
25+
26+ // @ts -expect-error
27+ limax ( input , { maintainCase : 'true' } ) ;
28+
29+ // @ts -expect-error
30+ limax ( input , { tone : 'true' } ) ;
31+
32+ // @ts -expect-error
33+ limax ( input , { custom : 'not-an-object' } ) ;
34+
35+ // @ts -expect-error
36+ limax ( input , { lang : 123 } ) ;
37+
38+ // @ts -expect-error
39+ limax ( input , { unknownOption : true } ) ;
You can’t perform that action at this time.
0 commit comments