deps/v8/src/messages.js
/**
 * Restrict source location start and end positions to make the source slice
 * no more that a certain number of characters wide.
 * @param {number} opt_limit The with limit of the source text with a default
 *     of 78
 * @param {number} opt_before The number of characters to prefer before the
 *     position with a default value of 10 less that the limit
 */
Restrict source location start and end positions to make the source slice
no more that a certain number of characters wide.
@param {number} opt_limit The with limit of the source text with a default
of 78
@param {number} opt_before The number of characters to prefer before the
position with a default value of 10 less that the limit
Restrict source location start and end positions to make the source slice no more that a certain number of characters wide . @param { number } opt_limit The with limit of the source text with a default of 78 @param { number } opt_before The number of characters to prefer before the position with a default value of 10 less that the limit
function SourceLocationRestrict(opt_limit, opt_before) {
  var limit;
  var before;
  if (!IS_UNDEFINED(opt_limit)) {
    limit = opt_limit;
  } else {
    limit = kLineLengthLimit;
  }
  if (!IS_UNDEFINED(opt_before)) {
    before = opt_before;
  } else {
    if (limit <= 20) {
      before = $floor(limit / 2);
    } else {
      before = limit - 10;
    }
  }
  if (before >= limit) {
    before = limit - 1;
  }
  if (this.end - this.start > limit) {
    var start_limit = this.position - before;
    var end_limit = this.position + limit - before;
    if (this.start < start_limit && end_limit < this.end) {
      this.start = start_limit;
      this.end = end_limit;
    } else if (this.start < start_limit) {
      this.start = this.end - limit;
    } else {
      this.end = this.start + limit;
    }
  }
}
function SourceLocationRestrict ( opt_limit , opt_before ) { var limit ; var before ; if ( ! IS_UNDEFINED ( opt_limit ) ) { limit = opt_limit ; } else { limit = kLineLengthLimit ; } if ( ! IS_UNDEFINED ( opt_before ) ) { before = opt_before ; } else { if ( limit <= 20 ) { before = $floor ( limit / 2 ) ; } else { before = limit - 10 ; } } if ( before >= limit ) { before = limit - 1 ; } if ( this . end - this . start > limit ) { var start_limit = this . position - before ; var end_limit = this . position + limit - before ; if ( this . start < start_limit && end_limit < this . end ) { this . start = start_limit ; this . end = end_limit ; } else if ( this . start < start_limit ) { this . start = this . end - limit ; } else { this . end = this . start + limit ; } } }
Restrict source location start and end positions to make the source slice
 no more that a certain number of characters wide.
Restrict source location start and end positions to make the source slice no more that a certain number of characters wide .
// Find the actual limit to use. // If no before is specified center for small limits and perfer more source // before the the position that after for longer limits. // If the [start, end[ interval is too big we restrict // it in one or both ends. We make sure to always produce // restricted intervals of maximum allowed size.