Update dependencies: @types/node to 11.12.0, eslint to 5.15.3, js-yaml to 3.13.0, typescript to 3.3.4000, uglify-js to 3.5.2.

This commit is contained in:
David Anson 2019-03-30 14:36:04 -07:00
parent 9b9532e163
commit ec35833751
6 changed files with 87 additions and 307 deletions

View file

@ -76,6 +76,7 @@ module.exports.includesSorted = function includesSorted(array, element) {
let left = 0;
let right = array.length - 1;
while (left <= right) {
/* eslint-disable no-bitwise */
const mid = (left + right) >> 1;
if (array[mid] < element) {
left = mid + 1;
@ -144,10 +145,10 @@ module.exports.headingStyleFor = function headingStyleFor(token) {
};
// Calls the provided function for each matching token
function filterTokens(params, type, callback) {
function filterTokens(params, type, handler) {
params.tokens.forEach(function forToken(token) {
if (token.type === type) {
callback(token);
handler(token);
}
});
}
@ -234,24 +235,24 @@ module.exports.makeTokenCache = makeTokenCache;
module.exports.forEachLine = function forEachLine(callback) {
tokenCache.lineMetadata.forEach(function forMetadata(metadata) {
// Parameters: line, lineIndex, inCode, onFence, inTable
callback.apply(this, metadata);
callback(...metadata);
});
};
// Calls the provided function for each specified inline child token
module.exports.forEachInlineChild =
function forEachInlineChild(params, type, callback) {
function forEachInlineChild(params, type, handler) {
filterTokens(params, "inline", function forToken(token) {
token.children.forEach(function forChild(child) {
if (child.type === type) {
callback(child, token);
handler(child, token);
}
});
});
};
// Calls the provided function for each heading's content
module.exports.forEachHeading = function forEachHeading(params, callback) {
module.exports.forEachHeading = function forEachHeading(params, handler) {
let heading = null;
params.tokens.forEach(function forToken(token) {
if (token.type === "heading_open") {
@ -259,14 +260,14 @@ module.exports.forEachHeading = function forEachHeading(params, callback) {
} else if (token.type === "heading_close") {
heading = null;
} else if ((token.type === "inline") && heading) {
callback(heading, token.content);
handler(heading, token.content);
}
});
};
// Calls the provided function for each inline code span's content
module.exports.forEachInlineCodeSpan =
function forEachInlineCodeSpan(input, callback) {
function forEachInlineCodeSpan(input, handler) {
let currentLine = 0;
let currentColumn = 0;
let index = 0;
@ -290,7 +291,7 @@ module.exports.forEachInlineCodeSpan =
(startColumn >= 0) &&
(tickCount === currentTicks)) {
// Found end backticks; invoke callback for code span
callback(
handler(
input.substring(startIndex, index - currentTicks),
startLine, startColumn, tickCount);
startIndex = -1;