code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function poll(checkedIndex) { var watchedFile = watchedFiles[checkedIndex]; if (!watchedFile) { return; } _fs.stat(watchedFile.fileName, function (err, stats) { if (err) { watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { watchedFile.mtime = getModifiedTime(watchedFile.fileName); watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); }
List of supported extensions in order of file resolution precedence.
poll
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function addFile(fileName, callback) { var file = { fileName: fileName, callback: callback, mtime: getModifiedTime(fileName) }; watchedFiles.push(file); if (watchedFiles.length === 1) { startWatchTimer(); } return file; }
List of supported extensions in order of file resolution precedence.
addFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function removeFile(file) { watchedFiles = ts.copyListRemovingItem(file, watchedFiles); }
List of supported extensions in order of file resolution precedence.
removeFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isNode4OrLater() { return parseInt(process.version.charAt(1)) >= 4; }
List of supported extensions in order of file resolution precedence.
isNode4OrLater
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function readFile(fileName, encoding) { if (!_fs.existsSync(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); var len = buffer.length; if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { // Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js, // flip all byte pairs and treat as little endian. len &= ~1; for (var i = 0; i < len; i += 2) { var temp = buffer[i]; buffer[i] = buffer[i + 1]; buffer[i + 1] = temp; } return buffer.toString("utf16le", 2); } if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { // Little endian UTF-16 byte order mark detected return buffer.toString("utf16le", 2); } if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { // UTF-8 byte order mark detected return buffer.toString("utf8", 3); } // Default is UTF-8 with no byte order mark return buffer.toString("utf8"); }
List of supported extensions in order of file resolution precedence.
readFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function writeFile(fileName, data, writeByteOrderMark) { // If a BOM is required, emit one if (writeByteOrderMark) { data = "\uFEFF" + data; } var fd; try { fd = _fs.openSync(fileName, "w"); _fs.writeSync(fd, data, undefined, "utf8"); } finally { if (fd !== undefined) { _fs.closeSync(fd); } } }
List of supported extensions in order of file resolution precedence.
writeFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getCanonicalPath(path) { return useCaseSensitiveFileNames ? path.toLowerCase() : path; }
List of supported extensions in order of file resolution precedence.
getCanonicalPath
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function readDirectory(path, extension, exclude) { var result = []; exclude = ts.map(exclude, function (s) { return getCanonicalPath(ts.combinePaths(path, s)); }); visitDirectory(path); return result; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name_3, extension)) { result.push(name_3); } } else if (stat.isDirectory()) { directories.push(name_3); } } } for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { var current = directories_1[_a]; visitDirectory(current); } } }
List of supported extensions in order of file resolution precedence.
readDirectory
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name_3, extension)) { result.push(name_3); } } else if (stat.isDirectory()) { directories.push(name_3); } } } for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { var current = directories_1[_a]; visitDirectory(current); } }
List of supported extensions in order of file resolution precedence.
visitDirectory
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function tokenIsIdentifierOrKeyword(token) { return token >= 69 /* Identifier */; }
List of supported extensions in order of file resolution precedence.
tokenIsIdentifierOrKeyword
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function lookupInUnicodeMap(code, map) { // Bail out quickly if it couldn't possibly be in the map. if (code < map[0]) { return false; } // Perform binary search in one of the Unicode range maps var lo = 0; var hi = map.length; var mid; while (lo + 1 < hi) { mid = lo + (hi - lo) / 2; // mid has to be even to catch a range's beginning mid -= mid % 2; if (map[mid] <= code && code <= map[mid + 1]) { return true; } if (code < map[mid]) { hi = mid; } else { lo = mid + 2; } } return false; }
List of supported extensions in order of file resolution precedence.
lookupInUnicodeMap
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isUnicodeIdentifierPart(code, languageVersion) { return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); }
List of supported extensions in order of file resolution precedence.
isUnicodeIdentifierPart
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function makeReverseMap(source) { var result = []; for (var name_4 in source) { if (source.hasOwnProperty(name_4)) { result[source[name_4]] = name_4; } } return result; }
List of supported extensions in order of file resolution precedence.
makeReverseMap
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function tokenToString(t) { return tokenStrings[t]; }
List of supported extensions in order of file resolution precedence.
tokenToString
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function stringToToken(s) { return textToToken[s]; }
List of supported extensions in order of file resolution precedence.
stringToToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getPositionOfLineAndCharacter(sourceFile, line, character) { return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); }
List of supported extensions in order of file resolution precedence.
getPositionOfLineAndCharacter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); }
List of supported extensions in order of file resolution precedence.
getLineStarts
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getLineAndCharacterOfPosition(sourceFile, position) { return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); }
We assume the first line starts at position 0 and 'position' is non-negative.
getLineAndCharacterOfPosition
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isWhiteSpace(ch) { // Note: nextLine is in the Zs space, and should be considered to be a whitespace. // It is explicitly not a line-break as it isn't in the exact set specified by EcmaScript. return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 133 /* nextLine */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; }
We assume the first line starts at position 0 and 'position' is non-negative.
isWhiteSpace
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isLineBreak(ch) { // ES5 7.3: // The ECMAScript line terminator characters are listed in Table 3. // Table 3: Line Terminator Characters // Code Unit Value Name Formal Name // \u000A Line Feed <LF> // \u000D Carriage Return <CR> // \u2028 Line separator <LS> // \u2029 Paragraph separator <PS> // Only the characters in Table 3 are treated as line terminators. Other new line or line // breaking characters are treated as white space but not as line terminators. return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */; }
We assume the first line starts at position 0 and 'position' is non-negative.
isLineBreak
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isDigit(ch) { return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; }
We assume the first line starts at position 0 and 'position' is non-negative.
isDigit
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isOctalDigit(ch) { return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; }
We assume the first line starts at position 0 and 'position' is non-negative.
isOctalDigit
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function couldStartTrivia(text, pos) { // Keep in sync with skipTrivia var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: case 10 /* lineFeed */: case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: case 47 /* slash */: // starts of normal trivia case 60 /* lessThan */: case 61 /* equals */: case 62 /* greaterThan */: // Starts of conflict marker trivia return true; case 35 /* hash */: // Only if its the beginning can we have #! trivia return pos === 0; default: return ch > 127 /* maxAsciiCharacter */; } }
We assume the first line starts at position 0 and 'position' is non-negative.
couldStartTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function skipTrivia(text, pos, stopAfterLineBreak) { // Keep in sync with couldStartTrivia while (true) { var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } case 10 /* lineFeed */: pos++; if (stopAfterLineBreak) { return pos; } continue; case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: pos++; continue; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; while (pos < text.length) { if (isLineBreak(text.charCodeAt(pos))) { break; } pos++; } continue; } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { pos += 2; while (pos < text.length) { if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; break; } pos++; } continue; } break; case 60 /* lessThan */: case 61 /* equals */: case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos); continue; } break; case 35 /* hash */: if (pos === 0 && isShebangTrivia(text, pos)) { pos = scanShebangTrivia(text, pos); continue; } break; default: if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; continue; } break; } return pos; } }
We assume the first line starts at position 0 and 'position' is non-negative.
skipTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isConflictMarkerTrivia(text, pos) { ts.Debug.assert(pos >= 0); // Conflict markers must be at the start of a line. if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } } return ch === 61 /* equals */ || text.charCodeAt(pos + mergeConflictMarkerLength) === 32 /* space */; } } return false; }
We assume the first line starts at position 0 and 'position' is non-negative.
isConflictMarkerTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanConflictMarkerTrivia(text, pos, error) { if (error) { error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); } var ch = text.charCodeAt(pos); var len = text.length; if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { while (pos < len && !isLineBreak(text.charCodeAt(pos))) { pos++; } } else { ts.Debug.assert(ch === 61 /* equals */); // Consume everything from the start of the mid-conlict marker to the start of the next // end-conflict marker. while (pos < len) { var ch_1 = text.charCodeAt(pos); if (ch_1 === 62 /* greaterThan */ && isConflictMarkerTrivia(text, pos)) { break; } pos++; } } return pos; }
We assume the first line starts at position 0 and 'position' is non-negative.
scanConflictMarkerTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isShebangTrivia(text, pos) { // Shebangs check must only be done at the start of the file ts.Debug.assert(pos === 0); return shebangTriviaRegex.test(text); }
We assume the first line starts at position 0 and 'position' is non-negative.
isShebangTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanShebangTrivia(text, pos) { var shebang = shebangTriviaRegex.exec(text)[0]; pos = pos + shebang.length; return pos; }
We assume the first line starts at position 0 and 'position' is non-negative.
scanShebangTrivia
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; while (pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } case 10 /* lineFeed */: pos++; if (trailing) { return result; } collecting = true; if (result && result.length) { ts.lastOrUndefined(result).hasTrailingNewLine = true; } continue; case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: pos++; continue; case 47 /* slash */: var nextChar = text.charCodeAt(pos + 1); var hasTrailingNewLine = false; if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { var kind = nextChar === 47 /* slash */ ? 2 /* SingleLineCommentTrivia */ : 3 /* MultiLineCommentTrivia */; var startPos = pos; pos += 2; if (nextChar === 47 /* slash */) { while (pos < text.length) { if (isLineBreak(text.charCodeAt(pos))) { hasTrailingNewLine = true; break; } pos++; } } else { while (pos < text.length) { if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; break; } pos++; } } if (collecting) { if (!result) { result = []; } result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); } continue; } break; default: if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { if (result && result.length && isLineBreak(ch)) { ts.lastOrUndefined(result).hasTrailingNewLine = true; } pos++; continue; } break; } return result; } return result; }
Extract comments from text prefixing the token closest following `pos`. The return value is an array containing a TextRange for each comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi - line comment ranges include the beginning '/* and ending '<asterisk>/' characters. The return value is undefined if no comments were found. @param trailing If false, whitespace is skipped until the first line break and comments between that location and the next token are returned. If true, comments occurring between the given position and the next line break are returned.
getCommentRanges
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getLeadingCommentRanges(text, pos) { return getCommentRanges(text, pos, /*trailing*/ false); }
Extract comments from text prefixing the token closest following `pos`. The return value is an array containing a TextRange for each comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi - line comment ranges include the beginning '/* and ending '<asterisk>/' characters. The return value is undefined if no comments were found. @param trailing If false, whitespace is skipped until the first line break and comments between that location and the next token are returned. If true, comments occurring between the given position and the next line break are returned.
getLeadingCommentRanges
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getTrailingCommentRanges(text, pos) { return getCommentRanges(text, pos, /*trailing*/ true); }
Extract comments from text prefixing the token closest following `pos`. The return value is an array containing a TextRange for each comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi - line comment ranges include the beginning '/* and ending '<asterisk>/' characters. The return value is undefined if no comments were found. @param trailing If false, whitespace is skipped until the first line break and comments between that location and the next token are returned. If true, comments occurring between the given position and the next line break are returned.
getTrailingCommentRanges
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanExactNumberOfHexDigits(count) { return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false); }
Scans the given number of hexadecimal digits in the text, returning -1 if the given number is unavailable.
scanExactNumberOfHexDigits
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanMinimumNumberOfHexDigits(count) { return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true); }
Scans as many hexadecimal digits as are available in the text, returning -1 if the given number of digits was unavailable.
scanMinimumNumberOfHexDigits
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanHexDigits(minCount, scanAsManyAsPossible) { var digits = 0; var value = 0; while (digits < minCount || scanAsManyAsPossible) { var ch = text.charCodeAt(pos); if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { value = value * 16 + ch - 48 /* _0 */; } else if (ch >= 65 /* A */ && ch <= 70 /* F */) { value = value * 16 + ch - 65 /* A */ + 10; } else if (ch >= 97 /* a */ && ch <= 102 /* f */) { value = value * 16 + ch - 97 /* a */ + 10; } else { break; } pos++; digits++; } if (digits < minCount) { value = -1; } return value; }
Scans as many hexadecimal digits as are available in the text, returning -1 if the given number of digits was unavailable.
scanHexDigits
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanString() { var quote = text.charCodeAt(pos++); var result = ""; var start = pos; while (true) { if (pos >= end) { result += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_string_literal); break; } var ch = text.charCodeAt(pos); if (ch === quote) { result += text.substring(start, pos); pos++; break; } if (ch === 92 /* backslash */) { result += text.substring(start, pos); result += scanEscapeSequence(); start = pos; continue; } if (isLineBreak(ch)) { result += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_string_literal); break; } pos++; } return result; }
Scans as many hexadecimal digits as are available in the text, returning -1 if the given number of digits was unavailable.
scanString
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanEscapeSequence() { pos++; if (pos >= end) { error(ts.Diagnostics.Unexpected_end_of_text); return ""; } var ch = text.charCodeAt(pos++); switch (ch) { case 48 /* _0 */: return "\0"; case 98 /* b */: return "\b"; case 116 /* t */: return "\t"; case 110 /* n */: return "\n"; case 118 /* v */: return "\v"; case 102 /* f */: return "\f"; case 114 /* r */: return "\r"; case 39 /* singleQuote */: return "\'"; case 34 /* doubleQuote */: return "\""; case 117 /* u */: // '\u{DDDDDDDD}' if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) { hasExtendedUnicodeEscape = true; pos++; return scanExtendedUnicodeEscape(); } // '\uDDDD' return scanHexadecimalEscape(/*numDigits*/ 4); case 120 /* x */: // '\xDD' return scanHexadecimalEscape(/*numDigits*/ 2); // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence), // the line terminator is interpreted to be "the empty code unit sequence". case 13 /* carriageReturn */: if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; } // fall through case 10 /* lineFeed */: case 8232 /* lineSeparator */: case 8233 /* paragraphSeparator */: return ""; default: return String.fromCharCode(ch); } }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scanEscapeSequence
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanHexadecimalEscape(numDigits) { var escapedValue = scanExactNumberOfHexDigits(numDigits); if (escapedValue >= 0) { return String.fromCharCode(escapedValue); } else { error(ts.Diagnostics.Hexadecimal_digit_expected); return ""; } }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scanHexadecimalEscape
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanExtendedUnicodeEscape() { var escapedValue = scanMinimumNumberOfHexDigits(1); var isInvalidExtendedEscape = false; // Validate the value of the digit if (escapedValue < 0) { error(ts.Diagnostics.Hexadecimal_digit_expected); isInvalidExtendedEscape = true; } else if (escapedValue > 0x10FFFF) { error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); isInvalidExtendedEscape = true; } if (pos >= end) { error(ts.Diagnostics.Unexpected_end_of_text); isInvalidExtendedEscape = true; } else if (text.charCodeAt(pos) === 125 /* closeBrace */) { // Only swallow the following character up if it's a '}'. pos++; } else { error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); isInvalidExtendedEscape = true; } if (isInvalidExtendedEscape) { return ""; } return utf16EncodeAsString(escapedValue); }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scanExtendedUnicodeEscape
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanIdentifierParts() { var result = ""; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92 /* backslash */) { ch = peekUnicodeEscape(); if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); result += String.fromCharCode(ch); // Valid Unicode escape is always six characters pos += 6; start = pos; } else { break; } } result += text.substring(start, pos); return result; }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scanIdentifierParts
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getIdentifierToken() { // Reserved words are between 2 and 11 characters long and start with a lowercase letter var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; } } return token = 69 /* Identifier */; }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
getIdentifierToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); var value = 0; // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. var numberOfDigits = 0; while (true) { var ch = text.charCodeAt(pos); var valueOfCh = ch - 48 /* _0 */; if (!isDigit(ch) || valueOfCh >= base) { break; } value = value * base + valueOfCh; pos++; numberOfDigits++; } // Invalid binaryIntegerLiteral or octalIntegerLiteral if (numberOfDigits === 0) { return -1; } return value; }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scanBinaryOrOctalDigits
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scan() { startPos = pos; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; while (true) { tokenPos = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; } var ch = text.charCodeAt(pos); // Special handling for shebang if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) { pos = scanShebangTrivia(text, pos); if (skipTrivia) { continue; } else { return token = 6 /* ShebangTrivia */; } } switch (ch) { case 10 /* lineFeed */: case 13 /* carriageReturn */: precedingLineBreak = true; if (skipTrivia) { pos++; continue; } else { if (ch === 13 /* carriageReturn */ && pos + 1 < end && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { // consume both CR and LF pos += 2; } else { pos++; } return token = 4 /* NewLineTrivia */; } case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: if (skipTrivia) { pos++; continue; } else { while (pos < end && isWhiteSpace(text.charCodeAt(pos))) { pos++; } return token = 5 /* WhitespaceTrivia */; } case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { return pos += 3, token = 33 /* ExclamationEqualsEqualsToken */; } return pos += 2, token = 31 /* ExclamationEqualsToken */; } return pos++, token = 49 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); return token = 9 /* StringLiteral */; case 96 /* backtick */: return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 62 /* PercentEqualsToken */; } return pos++, token = 40 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { return pos += 2, token = 51 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 66 /* AmpersandEqualsToken */; } return pos++, token = 46 /* AmpersandToken */; case 40 /* openParen */: return pos++, token = 17 /* OpenParenToken */; case 41 /* closeParen */: return pos++, token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 59 /* AsteriskEqualsToken */; } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { return pos += 3, token = 60 /* AsteriskAsteriskEqualsToken */; } return pos += 2, token = 38 /* AsteriskAsteriskToken */; } return pos++, token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { return pos += 2, token = 41 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 57 /* PlusEqualsToken */; } return pos++, token = 35 /* PlusToken */; case 44 /* comma */: return pos++, token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { return pos += 2, token = 42 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 58 /* MinusEqualsToken */; } return pos++, token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { return pos += 3, token = 22 /* DotDotDotToken */; } return pos++, token = 21 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; while (pos < end) { if (isLineBreak(text.charCodeAt(pos))) { break; } pos++; } if (skipTrivia) { continue; } else { return token = 2 /* SingleLineCommentTrivia */; } } // Multi-line comment if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { pos += 2; var commentClosed = false; while (pos < end) { var ch_2 = text.charCodeAt(pos); if (ch_2 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; commentClosed = true; break; } if (isLineBreak(ch_2)) { precedingLineBreak = true; } pos++; } if (!commentClosed) { error(ts.Diagnostics.Asterisk_Slash_expected); } if (skipTrivia) { continue; } else { tokenIsUnterminated = !commentClosed; return token = 3 /* MultiLineCommentTrivia */; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 61 /* SlashEqualsToken */; } return pos++, token = 39 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; var value = scanMinimumNumberOfHexDigits(1); if (value < 0) { error(ts.Diagnostics.Hexadecimal_digit_expected); value = 0; } tokenValue = "" + value; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { pos += 2; var value = scanBinaryOrOctalDigits(/* base */ 2); if (value < 0) { error(ts.Diagnostics.Binary_digit_expected); value = 0; } tokenValue = "" + value; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { pos += 2; var value = scanBinaryOrOctalDigits(/* base */ 8); if (value < 0) { error(ts.Diagnostics.Octal_digit_expected); value = 0; } tokenValue = "" + value; return token = 8 /* NumericLiteral */; } // Try to parse as an octal if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); return token = 8 /* NumericLiteral */; } // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do). case 49 /* _1 */: case 50 /* _2 */: case 51 /* _3 */: case 52 /* _4 */: case 53 /* _5 */: case 54 /* _6 */: case 55 /* _7 */: case 56 /* _8 */: case 57 /* _9 */: tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: return pos++, token = 54 /* ColonToken */; case 59 /* semicolon */: return pos++, token = 23 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { return pos += 3, token = 63 /* LessThanLessThanEqualsToken */; } return pos += 2, token = 43 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 28 /* LessThanEqualsToken */; } if (languageVariant === 1 /* JSX */ && text.charCodeAt(pos + 1) === 47 /* slash */ && text.charCodeAt(pos + 2) !== 42 /* asterisk */) { return pos += 2, token = 26 /* LessThanSlashToken */; } return pos++, token = 25 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { return pos += 3, token = 32 /* EqualsEqualsEqualsToken */; } return pos += 2, token = 30 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { return pos += 2, token = 34 /* EqualsGreaterThanToken */; } return pos++, token = 56 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { return token = 7 /* ConflictMarkerTrivia */; } } return pos++, token = 27 /* GreaterThanToken */; case 63 /* question */: return pos++, token = 53 /* QuestionToken */; case 91 /* openBracket */: return pos++, token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: return pos++, token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 68 /* CaretEqualsToken */; } return pos++, token = 48 /* CaretToken */; case 123 /* openBrace */: return pos++, token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { return pos += 2, token = 52 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 67 /* BarEqualsToken */; } return pos++, token = 47 /* BarToken */; case 125 /* closeBrace */: return pos++, token = 16 /* CloseBraceToken */; case 126 /* tilde */: return pos++, token = 50 /* TildeToken */; case 64 /* at */: return pos++, token = 55 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); return pos++, token = 0 /* Unknown */; default: if (isIdentifierStart(ch, languageVersion)) { pos++; while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92 /* backslash */) { tokenValue += scanIdentifierParts(); } return token = getIdentifierToken(); } else if (isWhiteSpace(ch)) { pos++; continue; } else if (isLineBreak(ch)) { precedingLineBreak = true; pos++; continue; } error(ts.Diagnostics.Invalid_character); return pos++, token = 0 /* Unknown */; } } }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
scan
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanGreaterToken() { if (token === 27 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { return pos += 3, token = 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } return pos += 2, token = 45 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; } return pos++, token = 44 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { return pos++, token = 29 /* GreaterThanEqualsToken */; } } return token; }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
reScanGreaterToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanSlashToken() { if (token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; while (true) { // If we reach the end of a file, or hit a newline, then this is an unterminated // regex. Report error and return what we have so far. if (p >= end) { tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_regular_expression_literal); break; } var ch = text.charCodeAt(p); if (isLineBreak(ch)) { tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_regular_expression_literal); break; } if (inEscape) { // Parsing an escape character; // reset the flag and just advance to the next char. inEscape = false; } else if (ch === 47 /* slash */ && !inCharacterClass) { // A slash within a character class is permissible, // but in general it signals the end of the regexp literal. p++; break; } else if (ch === 91 /* openBracket */) { inCharacterClass = true; } else if (ch === 92 /* backslash */) { inEscape = true; } else if (ch === 93 /* closeBracket */) { inCharacterClass = false; } p++; } while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; tokenValue = text.substring(tokenPos, pos); token = 10 /* RegularExpressionLiteral */; } return token; }
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
reScanSlashToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanTemplateToken() { ts.Debug.assert(token === 16 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); }
Unconditionally back up and scan a template expression portion.
reScanTemplateToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanJsxToken() { pos = tokenPos = startPos; return token = scanJsxToken(); }
Unconditionally back up and scan a template expression portion.
reScanJsxToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanJsxToken() { startPos = tokenPos = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; } var char = text.charCodeAt(pos); if (char === 60 /* lessThan */) { if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; return token = 26 /* LessThanSlashToken */; } pos++; return token = 25 /* LessThanToken */; } if (char === 123 /* openBrace */) { pos++; return token = 15 /* OpenBraceToken */; } while (pos < end) { pos++; char = text.charCodeAt(pos); if ((char === 123 /* openBrace */) || (char === 60 /* lessThan */)) { break; } } return token = 236 /* JsxText */; }
Unconditionally back up and scan a template expression portion.
scanJsxToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function speculationHelper(callback, isLookahead) { var savePos = pos; var saveStartPos = startPos; var saveTokenPos = tokenPos; var saveToken = token; var saveTokenValue = tokenValue; var savePrecedingLineBreak = precedingLineBreak; var result = callback(); // If our callback returned something 'falsy' or we're just looking ahead, // then unconditionally restore us to where we were. if (!result || isLookahead) { pos = savePos; startPos = saveStartPos; tokenPos = saveTokenPos; token = saveToken; tokenValue = saveTokenValue; precedingLineBreak = savePrecedingLineBreak; } return result; }
Unconditionally back up and scan a template expression portion.
speculationHelper
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function lookAhead(callback) { return speculationHelper(callback, /*isLookahead:*/ true); }
Unconditionally back up and scan a template expression portion.
lookAhead
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function tryScan(callback) { return speculationHelper(callback, /*isLookahead:*/ false); }
Unconditionally back up and scan a template expression portion.
tryScan
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setText(newText, start, length) { text = newText || ""; end = length === undefined ? text.length : start + length; setTextPos(start || 0); }
Unconditionally back up and scan a template expression portion.
setText
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setOnError(errorCallback) { onError = errorCallback; }
Unconditionally back up and scan a template expression portion.
setOnError
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setScriptTarget(scriptTarget) { languageVersion = scriptTarget; }
Unconditionally back up and scan a template expression portion.
setScriptTarget
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setLanguageVariant(variant) { languageVariant = variant; }
Unconditionally back up and scan a template expression portion.
setLanguageVariant
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setTextPos(textPos) { ts.Debug.assert(textPos >= 0); pos = textPos; startPos = textPos; tokenPos = textPos; token = 0 /* Unknown */; precedingLineBreak = false; tokenValue = undefined; hasExtendedUnicodeEscape = false; tokenIsUnterminated = false; }
Unconditionally back up and scan a template expression portion.
setTextPos
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { var declaration = declarations_1[_i]; if (declaration.kind === kind) { return declaration; } } } return undefined; }
Unconditionally back up and scan a template expression portion.
getDeclarationOfKind
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getSingleLineStringWriter() { if (stringWriters.length === 0) { var str = ""; var writeText = function (text) { return str += text; }; return { string: function () { return str; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. writeLine: function () { return str += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); }
Unconditionally back up and scan a template expression portion.
getSingleLineStringWriter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function releaseStringWriter(writer) { writer.clear(); stringWriters.push(writer); }
Unconditionally back up and scan a template expression portion.
releaseStringWriter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getFullWidth(node) { return node.end - node.pos; }
Unconditionally back up and scan a template expression portion.
getFullWidth
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function arrayIsEqualTo(array1, array2, equaler) { if (!array1 || !array2) { return array1 === array2; } if (array1.length !== array2.length) { return false; } for (var i = 0; i < array1.length; ++i) { var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; if (!equals) { return false; } } return true; }
Unconditionally back up and scan a template expression portion.
arrayIsEqualTo
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function hasResolvedModule(sourceFile, moduleNameText) { return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); }
Unconditionally back up and scan a template expression portion.
hasResolvedModule
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getResolvedModule(sourceFile, moduleNameText) { return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; }
Unconditionally back up and scan a template expression portion.
getResolvedModule
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } sourceFile.resolvedModules[moduleNameText] = resolvedModule; }
Unconditionally back up and scan a template expression portion.
setResolvedModule
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function containsParseError(node) { aggregateChildData(node); return (node.parserContextFlags & 64 /* ThisNodeOrAnySubNodesHasError */) !== 0; }
Unconditionally back up and scan a template expression portion.
containsParseError
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function aggregateChildData(node) { if (!(node.parserContextFlags & 128 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 64 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propogated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. node.parserContextFlags |= 128 /* HasAggregatedChildData */; } }
Unconditionally back up and scan a template expression portion.
aggregateChildData
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getSourceFileOfNode(node) { while (node && node.kind !== 248 /* SourceFile */) { node = node.parent; } return node; }
Unconditionally back up and scan a template expression portion.
getSourceFileOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getStartPositionOfLine(line, sourceFile) { ts.Debug.assert(line >= 0); return ts.getLineStarts(sourceFile)[line]; }
Unconditionally back up and scan a template expression portion.
getStartPositionOfLine
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getStartPosOfNode(node) { return node.pos; }
Unconditionally back up and scan a template expression portion.
getStartPosOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nodeIsPresent(node) { return !nodeIsMissing(node); }
Unconditionally back up and scan a template expression portion.
nodeIsPresent
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getTokenPosOfNode(node, sourceFile) { // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't* // want to skip trivia because this will launch us forward to the next token. if (nodeIsMissing(node)) { return node.pos; } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); }
Unconditionally back up and scan a template expression portion.
getTokenPosOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getNonDecoratorTokenPosOfNode(node, sourceFile) { if (nodeIsMissing(node) || !node.decorators) { return getTokenPosOfNode(node, sourceFile); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end); }
Unconditionally back up and scan a template expression portion.
getNonDecoratorTokenPosOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { if (includeTrivia === void 0) { includeTrivia = false; } if (nodeIsMissing(node)) { return ""; } var text = sourceFile.text; return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end); }
Unconditionally back up and scan a template expression portion.
getSourceTextOfNodeFromSourceFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getTextOfNodeFromSourceText(sourceText, node) { if (nodeIsMissing(node)) { return ""; } return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); }
Unconditionally back up and scan a template expression portion.
getTextOfNodeFromSourceText
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getTextOfNode(node, includeTrivia) { if (includeTrivia === void 0) { includeTrivia = false; } return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); }
Unconditionally back up and scan a template expression portion.
getTextOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function makeIdentifierFromModuleName(moduleName) { return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); }
Unconditionally back up and scan a template expression portion.
makeIdentifierFromModuleName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isBlockOrCatchScoped(declaration) { return (getCombinedNodeFlags(declaration) & 24576 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclaration(declaration); }
Unconditionally back up and scan a template expression portion.
isBlockOrCatchScoped
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isCatchClauseVariableDeclaration(declaration) { return declaration && declaration.kind === 211 /* VariableDeclaration */ && declaration.parent && declaration.parent.kind === 244 /* CatchClause */; }
Unconditionally back up and scan a template expression portion.
isCatchClauseVariableDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function declarationNameToString(name) { return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); }
Unconditionally back up and scan a template expression portion.
declarationNameToString
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createDiagnosticForNode(node, message, arg0, arg1, arg2) { var sourceFile = getSourceFileOfNode(node); var span = getErrorSpanForNode(sourceFile, node); return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); }
Unconditionally back up and scan a template expression portion.
createDiagnosticForNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createDiagnosticForNodeFromMessageChain(node, messageChain) { var sourceFile = getSourceFileOfNode(node); var span = getErrorSpanForNode(sourceFile, node); return { file: sourceFile, start: span.start, length: span.length, code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText }; }
Unconditionally back up and scan a template expression portion.
createDiagnosticForNodeFromMessageChain
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getSpanOfTokenAtPosition(sourceFile, pos) { var scanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.languageVariant, sourceFile.text, /*onError:*/ undefined, pos); scanner.scan(); var start = scanner.getTokenPos(); return ts.createTextSpanFromBounds(start, scanner.getTextPos()); }
Unconditionally back up and scan a template expression portion.
getSpanOfTokenAtPosition
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { case 248 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. case 211 /* VariableDeclaration */: case 163 /* BindingElement */: case 214 /* ClassDeclaration */: case 186 /* ClassExpression */: case 215 /* InterfaceDeclaration */: case 218 /* ModuleDeclaration */: case 217 /* EnumDeclaration */: case 247 /* EnumMember */: case 213 /* FunctionDeclaration */: case 173 /* FunctionExpression */: errorNode = node.name; break; } if (errorNode === undefined) { // If we don't have a better node, then just set the error on the first token of // construct. return getSpanOfTokenAtPosition(sourceFile, node.pos); } var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return ts.createTextSpanFromBounds(pos, errorNode.end); }
Unconditionally back up and scan a template expression portion.
getErrorSpanForNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isExternalModule(file) { return file.externalModuleIndicator !== undefined; }
Unconditionally back up and scan a template expression portion.
isExternalModule
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; }
Unconditionally back up and scan a template expression portion.
isExternalOrCommonJsModule
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isDeclarationFile(file) { return (file.flags & 4096 /* DeclarationFile */) !== 0; }
Unconditionally back up and scan a template expression portion.
isDeclarationFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isConstEnumDeclaration(node) { return node.kind === 217 /* EnumDeclaration */ && isConst(node); }
Unconditionally back up and scan a template expression portion.
isConstEnumDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function walkUpBindingElementsAndPatterns(node) { while (node && (node.kind === 163 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; }
Unconditionally back up and scan a template expression portion.
walkUpBindingElementsAndPatterns
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isConst(node) { return !!(getCombinedNodeFlags(node) & 16384 /* Const */); }
Unconditionally back up and scan a template expression portion.
isConst
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isLet(node) { return !!(getCombinedNodeFlags(node) & 8192 /* Let */); }
Unconditionally back up and scan a template expression portion.
isLet
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isPrologueDirective(node) { return node.kind === 195 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; }
Unconditionally back up and scan a template expression portion.
isPrologueDirective
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); }
Unconditionally back up and scan a template expression portion.
getLeadingCommentRangesOfNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getLeadingCommentRangesOfNodeFromText(node, text) { return ts.getLeadingCommentRanges(text, node.pos); }
Unconditionally back up and scan a template expression portion.
getLeadingCommentRangesOfNodeFromText
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getJsDocComments(node, sourceFileOfNode) { return getJsDocCommentsFromText(node, sourceFileOfNode.text); }
Unconditionally back up and scan a template expression portion.
getJsDocComments
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getJsDocCommentsFromText(node, text) { var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */; } }
Unconditionally back up and scan a template expression portion.
getJsDocCommentsFromText
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */; }
Unconditionally back up and scan a template expression portion.
isJsDocComment
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isRequireCall(expression) { // of the form 'require("name")' return expression.kind === 168 /* CallExpression */ && expression.expression.kind === 69 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1 && expression.arguments[0].kind === 9 /* StringLiteral */; }
Returns true if the node is a CallExpression to the identifier 'require' with exactly one string literal argument. This function does not test if the node is in a JavaScript file or not.
isRequireCall
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isExportsPropertyAssignment(expression) { // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary return isInJavaScriptFile(expression) && (expression.kind === 181 /* BinaryExpression */) && (expression.operatorToken.kind === 56 /* EqualsToken */) && (expression.left.kind === 166 /* PropertyAccessExpression */) && (expression.left.expression.kind === 69 /* Identifier */) && ((expression.left.expression).text === "exports"); }
Returns true if the node is an assignment to a property on the identifier 'exports'. This function does not test if the node is in a JavaScript file or not.
isExportsPropertyAssignment
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isModuleExportsAssignment(expression) { // of the form 'module.exports = expr' where 'expr' is arbitrary return isInJavaScriptFile(expression) && (expression.kind === 181 /* BinaryExpression */) && (expression.operatorToken.kind === 56 /* EqualsToken */) && (expression.left.kind === 166 /* PropertyAccessExpression */) && (expression.left.expression.kind === 69 /* Identifier */) && ((expression.left.expression).text === "module") && (expression.left.name.text === "exports"); }
Returns true if the node is an assignment to the property access expression 'module.exports'. This function does not test if the node is in a JavaScript file or not.
isModuleExportsAssignment
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getExternalModuleName(node) { if (node.kind === 222 /* ImportDeclaration */) { return node.moduleSpecifier; } if (node.kind === 221 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; if (reference.kind === 232 /* ExternalModuleReference */) { return reference.expression; } } if (node.kind === 228 /* ExportDeclaration */) { return node.moduleSpecifier; } }
Returns true if the node is an assignment to the property access expression 'module.exports'. This function does not test if the node is in a JavaScript file or not.
getExternalModuleName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function hasQuestionToken(node) { if (node) { switch (node.kind) { case 138 /* Parameter */: case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: case 246 /* ShorthandPropertyAssignment */: case 245 /* PropertyAssignment */: case 141 /* PropertyDeclaration */: case 140 /* PropertySignature */: return node.questionToken !== undefined; } } return false; }
Returns true if the node is an assignment to the property access expression 'module.exports'. This function does not test if the node is in a JavaScript file or not.
hasQuestionToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT