Remove trimLeft/trimRight helpers; use native implementations.

This commit is contained in:
David Anson 2019-04-17 14:54:27 -07:00
parent 22c36c388f
commit 73511ff677
4 changed files with 7 additions and 46 deletions

View file

@ -2,8 +2,8 @@
"use strict";
const { addError, filterTokens, forEachLine, includesSorted, rangeFromRegExp,
trimRight } = require("../helpers");
const { addError, filterTokens, forEachLine, includesSorted, rangeFromRegExp } =
require("../helpers");
const { lineMetadata } = require("./cache");
const trailingSpaceRe = /\s+$/;
@ -34,7 +34,7 @@ module.exports = {
const lineNumber = lineIndex + 1;
if (trailingSpaceRe.test(line) &&
!includesSorted(listItemLineNumbers, lineNumber)) {
const actual = line.length - trimRight(line).length;
const actual = line.length - line.trimRight().length;
if (expected !== actual) {
addError(onError, lineNumber,
"Expected: " + (expected === 0 ? "" : "0 or ") +