Comparing version 0.6.0 to 0.7.0
@@ -9,2 +9,8 @@ /** | ||
} | ||
export declare var Buffer: { | ||
new (str: string, encoding?: string): Buffer; | ||
new (size: number): Buffer; | ||
byteLength(string: string, encoding?: string): number; | ||
concat(list: Buffer[], totalLength?: number): Buffer; | ||
}; | ||
export interface Source { | ||
@@ -11,0 +17,0 @@ /** |
10
index.js
@@ -16,3 +16,3 @@ var __extends = (this && this.__extends) || function (d, b) { | ||
BufferIterator.fromString = function (str, encoding) { | ||
var buffer = new Buffer(str, encoding); | ||
var buffer = new exports.Buffer(str, encoding); | ||
return new BufferIterator(buffer); | ||
@@ -168,3 +168,3 @@ }; | ||
this._block_size = _block_size; | ||
this._buffer = new Buffer(0); | ||
this._buffer = new exports.Buffer(0); | ||
} | ||
@@ -198,3 +198,3 @@ Object.defineProperty(BufferedSourceReader.prototype, "position", { | ||
BufferedSourceReader.prototype._fillBuffer = function (length) { | ||
var buffer = new Buffer(length); | ||
var buffer = new exports.Buffer(length); | ||
// always read from the current position | ||
@@ -205,3 +205,3 @@ var bytesRead = this._source.read(buffer, 0, length, this._position); | ||
// use the Buffer.concat totalLength argument to slice the fresh buffer if needed | ||
this._buffer = Buffer.concat([this._buffer, buffer], this._buffer.length + bytesRead); | ||
this._buffer = exports.Buffer.concat([this._buffer, buffer], this._buffer.length + bytesRead); | ||
return bytesRead < length; | ||
@@ -302,3 +302,3 @@ }; | ||
// to advance the underlying buffer appropriately | ||
var byteLength = Buffer.byteLength(str, this._encoding); | ||
var byteLength = exports.Buffer.byteLength(str, this._encoding); | ||
// we cannot skip more than `this._buffer.length` bytes | ||
@@ -305,0 +305,0 @@ // var bytesSkipped = Math.min(byteLength, this._buffer.length); // is this necessary? |
{ | ||
"name": "lexing", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Regex-based lexer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import assert from 'assert'; | ||
import {describe, it} from 'mocha'; | ||
import {compare, indexOf, equalTo} from '../util'; | ||
import {compare, indexOf, equalTo} from '../buffer'; | ||
describe('util bufferops', () => { | ||
describe('buffer util', () => { | ||
describe('#compare', () => { | ||
@@ -8,0 +8,0 @@ var haystack = new Buffer('<< /Name (hello) >>'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53813
11
1162