File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -72,15 +72,20 @@ export const DOC_API_HEADING_TYPES = [
72
72
// This is a mapping for types within the Markdown content and their respective
73
73
// JavaScript primitive types within the MDN JavaScript docs
74
74
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values
75
- export const DOC_TYPES_MAPPING_PRIMITIVES = [
76
- 'null' ,
77
- 'undefined' ,
78
- 'boolean' ,
79
- 'number' ,
80
- 'bigint' ,
81
- 'string' ,
82
- 'symbol' ,
83
- ] ;
75
+ export const DOC_TYPES_MAPPING_PRIMITIVES = {
76
+ ...Object . fromEntries (
77
+ [
78
+ 'null' ,
79
+ 'undefined' ,
80
+ 'boolean' ,
81
+ 'number' ,
82
+ 'bigint' ,
83
+ 'string' ,
84
+ 'symbol' ,
85
+ ] . map ( e => [ e , e ] )
86
+ ) ,
87
+ integer : 'number' ,
88
+ } ;
84
89
85
90
// This is a mapping for types within the Markdown content and their respective
86
91
// JavaScript globals types within the MDN JavaScript docs
Original file line number Diff line number Diff line change @@ -81,8 +81,10 @@ export const transformTypeToReferenceLink = type => {
81
81
*/
82
82
const transformType = lookupPiece => {
83
83
// Transform JS primitive type references into Markdown links (MDN)
84
- if ( DOC_TYPES_MAPPING_PRIMITIVES . includes ( lookupPiece . toLowerCase ( ) ) ) {
85
- return `${ DOC_MDN_BASE_URL_JS_PRIMITIVES } #${ lookupPiece . toLowerCase ( ) } _type` ;
84
+ if ( lookupPiece . toLowerCase ( ) in DOC_TYPES_MAPPING_PRIMITIVES ) {
85
+ const typeValue = DOC_TYPES_MAPPING_PRIMITIVES [ lookupPiece . toLowerCase ( ) ] ;
86
+
87
+ return `${ DOC_MDN_BASE_URL_JS_PRIMITIVES } #${ typeValue } _type` ;
86
88
}
87
89
88
90
// Transforms JS Global type references into Markdown links (MDN)
You can’t perform that action at this time.
0 commit comments