Skip to content

Commit 4835efa

Browse files
committedMay 21, 2019
Only use a CommonJS export for the TypeScript definition
1 parent 12b58bb commit 4835efa

File tree

4 files changed

+38
-42
lines changed

4 files changed

+38
-42
lines changed
 

‎.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'

‎index.d.ts

+30-37
Original file line numberDiff line numberDiff line change
@@ -83,42 +83,35 @@ declare namespace slugify {
8383
}
8484
}
8585

86-
declare const slugify: {
87-
/**
88-
Slugify a string.
89-
90-
@param input - The string to slugify.
91-
92-
@example
93-
```
94-
import slugify = require('@sindresorhus/slugify');
95-
96-
slugify('I ♥ Dogs');
97-
//=> 'i-love-dogs'
98-
99-
slugify(' Déjà Vu! ');
100-
//=> 'deja-vu'
101-
102-
slugify('fooBar 123 $#%');
103-
//=> 'foo-bar-123'
104-
105-
slugify('I ♥ 🦄 & 🐶', {
106-
customReplacements: [
107-
['🐶', 'dog']
108-
]
109-
});
110-
//=> 'i-love-unicorn-and-dog'
111-
```
112-
*/
113-
(input: string, options?: slugify.Options): string;
114-
115-
// TODO: Remove this for the next major release, refactor the whole definition to:
116-
// declare function slugify(
117-
// input: string,
118-
// options?: slugify.Options
119-
// ): string;
120-
// export = slugify;
121-
default: typeof slugify;
122-
};
86+
/**
87+
Slugify a string.
88+
89+
@param string - String to slugify.
90+
91+
@example
92+
```
93+
import slugify = require('@sindresorhus/slugify');
94+
95+
slugify('I ♥ Dogs');
96+
//=> 'i-love-dogs'
97+
98+
slugify(' Déjà Vu! ');
99+
//=> 'deja-vu'
100+
101+
slugify('fooBar 123 $#%');
102+
//=> 'foo-bar-123'
103+
104+
slugify('I ♥ 🦄 & 🐶', {
105+
customReplacements: [
106+
['🐶', 'dog']
107+
]
108+
});
109+
//=> 'i-love-unicorn-and-dog'
110+
```
111+
*/
112+
declare function slugify(
113+
string: string,
114+
options?: slugify.Options
115+
): string;
123116

124117
export = slugify;

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
"id"
4242
],
4343
"dependencies": {
44-
"escape-string-regexp": "^1.0.5",
44+
"escape-string-regexp": "^2.0.0",
4545
"lodash.deburr": "^4.1.0"
4646
},
4747
"devDependencies": {
4848
"ava": "^1.4.1",
49-
"tsd": "^0.7.2",
49+
"tsd": "^0.7.3",
5050
"xo": "^0.24.0"
5151
}
5252
}

‎readme.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ slugify('I ♥ 🦄 & 🐶', {
3838

3939
## API
4040

41-
### slugify(input, [options])
41+
### slugify(string, [options])
4242

43-
#### input
43+
#### string
4444

4545
Type: `string`
4646

47+
String to slugify.
48+
4749
#### options
4850

49-
Type: `Object`
51+
Type: `object`
5052

5153
##### separator
5254

0 commit comments

Comments
 (0)
Please sign in to comment.