Skip to content

Commit

Permalink
doc,tool: add ref to Integer
Browse files Browse the repository at this point in the history
We documented most types as Integer, but we don't have link for that.

PR-URL: nodejs#8740
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
yorkie committed Sep 26, 2016
1 parent c9b59e8 commit eaa0806
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tools/doc/type-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
'Reference/Global_Objects/';
const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' +
'JavaScript/Data_structures';
const jsPrimitives = [
'Number', 'String', 'Boolean', 'Null', 'Symbol'
];
const jsPrimitives = {
'Integer': 'Number', // this is for extending
'Number': 'Number',
'String': 'String',
'Boolean': 'Boolean',
'Null': 'Null',
'Symbol': 'Symbol'
};
const jsGlobalTypes = [
'Error', 'Object', 'Function', 'Array', 'Uint8Array',
'Error', 'Object', 'Function', 'Array', 'TypedArray', 'Uint8Array',
'Uint16Array', 'Uint32Array', 'Int8Array', 'Int16Array', 'Int32Array',
'Uint8ClampedArray', 'Float32Array', 'Float64Array', 'Date', 'RegExp',
'ArrayBuffer', 'DataView', 'Promise', 'EvalError', 'RangeError',
Expand Down Expand Up @@ -38,8 +43,9 @@ module.exports = {
typeText = typeText.trim();
if (typeText) {
let typeUrl = null;
if (jsPrimitives.indexOf(typeText) !== -1) {
typeUrl = jsPrimitiveUrl + '#' + typeText + '_type';
const primitive = jsPrimitives[typeText];
if (primitive !== undefined) {
typeUrl = `${jsPrimitiveUrl}#${primitive}_type`;
} else if (jsGlobalTypes.indexOf(typeText) !== -1) {
typeUrl = jsDocUrl + typeText;
} else if (typeMap[typeText]) {
Expand Down

0 comments on commit eaa0806

Please sign in to comment.