File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { BASE_HTTP_ERRORS } from "./src/constants/index.js" ;
22import { generateError } from "./utils/generateError.js" ;
33import { HttpError } from "./utils/http-error.js" ;
4- import statuses from 'statuses' ;
5-
6- import fs from 'fs' ;
7-
8- const lines = Object . entries ( statuses . message )
9- . map ( ( [ code , message ] ) => {
10- const name = message . toUpperCase ( ) . replace ( / [ ^ A - Z 0 - 9 ] + / g, '_' ) ;
11- return ` * ${ name } : HttpErrorConstant,` ;
12- } )
13- . join ( '\n' ) ;
14-
15- const typedef = `/**
16- * @typedef {Object} HttpErrorConstant
17- * @property {number} status
18- * @property {string} code
19- * @property {string} message
20- */
21-
22- /**
23- * @typedef {{
24- ${ lines }
25- }} BaseHttpErrors
26- */` ;
27-
28- fs . writeFileSync ( './http-error-typedef.jsdoc' , typedef ) ;
294
305export { HttpError , generateError , BASE_HTTP_ERRORS } ;
You can’t perform that action at this time.
0 commit comments