@@ -18,6 +18,11 @@ File extension regex
1818- [ Install] ( #install )
1919- [ Use] ( #use )
2020- [ API] ( #api )
21+ - [ ` EXT_DTS_REGEX ` ] ( #ext_dts_regex )
22+ - [ ` EXT_JS_REGEX ` ] ( #ext_js_regex )
23+ - [ ` EXT_JSON_REGEX ` ] ( #ext_json_regex )
24+ - [ ` EXT_TS_REGEX ` ] ( #ext_ts_regex )
25+ - [ ` extRegex(ext[, options]) ` ] ( #extregexext-options )
2126- [ Types] ( #types )
2227 - [ Interfaces] ( #interfaces )
2328- [ Related] ( #related )
@@ -64,7 +69,118 @@ yarn add @flex-development/ext-regex@flex-development/ext-regex
6469
6570## API
6671
67- ** TODO** : api documentation.
72+ This package exports the following identifiers:
73+
74+ - [ ` EXT_DTS_REGEX ` ] ( #ext_dts_regex )
75+ - [ ` EXT_JS_REGEX ` ] ( #ext_js_regex )
76+ - [ ` EXT_JSON_REGEX ` ] ( #ext_json_regex )
77+ - [ ` EXT_TS_REGEX ` ] ( #ext_ts_regex )
78+ - [ ` extRegex ` ] ( #extregexext-options )
79+
80+ There is no default export.
81+
82+ ### ` EXT_DTS_REGEX `
83+
84+ TypeScript declaration file extension regex.
85+
86+ Supported extensions:
87+
88+ - ` .d.cts `
89+ - ` .d.mts `
90+ - ` .d.ts `
91+
92+ Named capturing groups:
93+
94+ - ` type ` : Letter between ` '.' ` and ` 'ts' ` in file extension
95+
96+ #### Source
97+
98+ > [ ` src/regex/dts.ts ` ] ( src/regex/dts.ts )
99+
100+ ### ` EXT_JS_REGEX `
101+
102+ JavaScript file extension regex.
103+
104+ Supported extensions:
105+
106+ - ` .cjs `
107+ - ` .js `
108+ - ` .jsx `
109+ - ` .mjs `
110+
111+ Named capturing groups:
112+
113+ - ` type ` : Letter between ` '.' ` and ` 'js' ` in file extension
114+
115+ #### Source
116+
117+ > [ ` src/regex/js.ts ` ] ( src/regex/js.ts )
118+
119+ ### ` EXT_JSON_REGEX `
120+
121+ JSON file extension regex.
122+
123+ Supported extensions:
124+
125+ - ` .json `
126+ - ` .json5 `
127+ - ` .jsonc `
128+
129+ Named capturing groups:
130+
131+ - ` type ` : Character after ` 'json' ` in file extension
132+
133+ #### Source
134+
135+ > [ ` src/regex/json.ts ` ] ( src/regex/json.ts )
136+
137+ ### ` EXT_TS_REGEX `
138+
139+ TypeScript file extension regex.
140+
141+ Supported extensions:
142+
143+ - ` .cts `
144+ - ` .d.cts `
145+ - ` .d.mts `
146+ - ` .d.ts `
147+ - ` .mts `
148+ - ` .ts `
149+ - ` .tsx `
150+
151+ Named capturing groups:
152+
153+ - ` dts ` : Letter ` 'd' ` if extension is [ declaration file extension] ( #ext_dts_regex )
154+ - ` type ` : Letter between ` '.' ` and ` 'ts' ` in file extension
155+
156+ #### Source
157+
158+ > [ ` src/regex/ts.ts ` ] ( src/regex/ts.ts )
159+
160+ ### ` extRegex(ext[, options]) `
161+
162+ Creates a regular expression matching the given file extension, ` ext ` .
163+
164+ The file extension does not need to begin with a dot character (` '.' ` ). If it doesn't, however, it will be formatted
165+ before being converted into a regular expression pattern. The returned regular expression will match the formatted file
166+ extension instead.
167+
168+ #### Parameters
169+
170+ - ` {string} ` ** ` ext ` ** &mdash ; File extension to evaluate
171+ - ` {Options?} ` ** ` [options] ` ** &mdash ; Regular expression options
172+
173+ #### Returns
174+
175+ ` {RegExp} ` Regular expression matching ` ext ` .
176+
177+ #### Throws
178+
179+ ` {errnode.NodeError<TypeError>} ` If ` ext ` is not a string.
180+
181+ #### Source
182+
183+ > [ ` src/utils/ext-regex.ts ` ] ( src/utils/ext-regex.ts )
68184
69185## Types
70186
0 commit comments