@@ -36,6 +36,9 @@ const FUNCTION_CALL = '\\([^)]*\\)';
3636// Group 2: foo.bar
3737const PROPERTY = `${ CAMEL_CASE } (?:(\\[${ CAMEL_CASE } \\])|\\.(\\w+))` ;
3838
39+ // An array of objects defining the different types of API doc headings we want to
40+ // capture and their respective regex to match against the heading text.
41+ // The regex are case-insensitive.
3942export const DOC_API_HEADING_TYPES = [
4043 {
4144 type : 'method' ,
@@ -67,37 +70,28 @@ export const DOC_API_HEADING_TYPES = [
6770// JavaScript primitive types within the MDN JavaScript docs
6871// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values
6972export const DOC_TYPES_MAPPING_PRIMITIVES = {
70- ...Object . fromEntries (
71- [
72- 'null' ,
73- 'undefined' ,
74- 'boolean' ,
75- 'number' ,
76- 'bigint' ,
77- 'string' ,
78- 'symbol' ,
79- ] . map ( e => [ e , e ] )
80- ) ,
73+ null : 'null' ,
74+ undefined : 'undefined' ,
75+ boolean : 'boolean' ,
76+ number : 'number' ,
77+ bigint : 'bigint' ,
78+ string : 'string' ,
79+ symbol : 'symbol' ,
8180 integer : 'number' ,
8281} ;
8382
8483// This is a mapping for types within the Markdown content and their respective
8584// JavaScript globals types within the MDN JavaScript docs
8685// @see DOC_MDN_BASE_URL_JS_GLOBALS
8786export const DOC_TYPES_MAPPING_GLOBALS = {
88- ...Object . fromEntries (
89- [
90- // This is updated with every ES-spec, so, as long as the
91- // `globals` package is up-to-date, so will our globals
92- // list.
93- ...Object . keys ( globals . builtin ) ,
94- 'AsyncGeneratorFunction' ,
95- 'AsyncIterator' ,
96- 'AsyncFunction' ,
97- 'TypedArray' ,
98- 'ErrorEvent' ,
99- ] . map ( e => [ e , e ] )
100- ) ,
87+ // This is updated with every ES-spec, so, as long as the
88+ // `globals` package is up-to-date, so will our globals list.
89+ ...Object . fromEntries ( Object . keys ( globals . builtin ) . map ( e => [ e , e ] ) ) ,
90+ AsyncGeneratorFunction : 'AsyncGeneratorFunction' ,
91+ AsyncIterator : 'AsyncIterator' ,
92+ AsyncFunction : 'AsyncFunction' ,
93+ TypedArray : 'TypedArray' ,
94+ ErrorEvent : 'ErrorEvent' ,
10195 'WebAssembly.Instance' : 'WebAssembly/Instance' ,
10296} ;
10397
0 commit comments