diff options
author | Chris Rebert <code@rebertia.com> | 2014-11-07 12:05:30 +0300 |
---|---|---|
committer | Chris Rebert <code@rebertia.com> | 2014-11-07 12:05:30 +0300 |
commit | 09c220563a1f7ac61dbe98f85534d96c97cd8e5f (patch) | |
tree | 218f8ffa28ce21f1e148c643c84cffed7b733b85 /dist | |
parent | b2d2a4420e60268414a7f5d1968f9420aacfe5bc (diff) |
grunt dist
Diffstat (limited to 'dist')
-rw-r--r-- | dist/browser/bootlint.js | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/dist/browser/bootlint.js b/dist/browser/bootlint.js index 2bc7546..6d80b97 100644 --- a/dist/browser/bootlint.js +++ b/dist/browser/bootlint.js @@ -11173,88 +11173,4 @@ var LocationIndex = _location.LocationIndex; } })(typeof exports === 'object' && exports || this); -},{"./location":5,"cheerio":2,"semver":3}],5:[function(require,module,exports){ -/*eslint-env node */ -var binarySearch = require('binary-search'); - -(function () { - 'use strict'; - - /* - * line is a 0-based line index - * column is a 0-based column index - */ - function Location(line, column) { - this.line = line; - this.column = column; - } - exports.Location = Location; - - /** - * Maps code unit indices into the string to line numbers and column numbers. - * @param {string} String to construct the index for - */ - function LocationIndex(string) { - // ensure newline termination - if (string[string.length - 1] !== '\n') { - string += '\n'; - } - this._stringLength = string.length; - /** - * Each triple in _lineStartEndTriples consists of: - * [0], the 0-based line index of the line the triple represents - * [1], the 0-based code unit index (into the string) of the start of the line (inclusive) - * [2], the 0-based code unit index (into the string) of the start of the next line (or the length of the string, if it is the last line) - * A line starts with a non-newline character, - * and always ends in a newline character, unless it is the very last line in the string. - */ - this._lineStartEndTriples = [[0, 0]]; - var nextLineIndex = 1; - var charIndex = 0; - while (charIndex < string.length) { - charIndex = string.indexOf("\n", charIndex); - if (charIndex === -1) { - break; - } - charIndex++;// go past the newline - this._lineStartEndTriples[this._lineStartEndTriples.length - 1].push(charIndex); - this._lineStartEndTriples.push([nextLineIndex, charIndex]); - - nextLineIndex++; - } - this._lineStartEndTriples.pop(); - } - exports.LocationIndex = LocationIndex; - - /** - * Translates a code unit index into its corresponding Location (line index and column index) within the string - * @param {integer} 0-based code unit index into the string - * @returns {Location|null} A Location corresponding to the index, or null if the index is out of bounds - */ - LocationIndex.prototype.locationOf = function (charIndex) { - if (charIndex < 0 || charIndex >= this._stringLength) { - return null; - } - var index = binarySearch(this._lineStartEndTriples, charIndex, function (bucket, needle) { - if (needle < bucket[1]) { - return 1; - } - else if (needle >= bucket[2]) { - return -1; - } - else { - return 0; - } - }); - if (index < 0) { // binarySearch returns a negative number (but not necessarily -1) when match not found - return null; - } - var lineStartEnd = this._lineStartEndTriples[index]; - var lineIndex = lineStartEnd[0]; - var lineStartIndex = lineStartEnd[1]; - var columnIndex = charIndex - lineStartIndex; - return new Location(lineIndex, columnIndex); - }; -})(); - -},{"binary-search":1}]},{},[4]); +},{"./location":1,"cheerio":2,"semver":3}]},{},[4]); |