Comparing version 0.7.2 to 0.7.3
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/** | ||
@@ -2,0 +3,0 @@ Returns true iff `haystack`, starting at fromIndex, matches `needle`. |
23
index.js
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
@@ -61,3 +62,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
return BufferIterator; | ||
})(); | ||
}()); | ||
exports.BufferIterator = BufferIterator; | ||
@@ -115,3 +116,3 @@ /** | ||
return StringIterator; | ||
})(); | ||
}()); | ||
exports.StringIterator = StringIterator; | ||
@@ -148,3 +149,3 @@ /** | ||
return ArrayIterator; | ||
})(); | ||
}()); | ||
exports.ArrayIterator = ArrayIterator; | ||
@@ -260,3 +261,3 @@ /** | ||
return BufferedSourceReader; | ||
})(); | ||
}()); | ||
exports.BufferedSourceReader = BufferedSourceReader; | ||
@@ -274,3 +275,3 @@ var SourceBufferIterator = (function (_super) { | ||
return SourceBufferIterator; | ||
})(BufferedSourceReader); | ||
}(BufferedSourceReader)); | ||
exports.SourceBufferIterator = SourceBufferIterator; | ||
@@ -319,3 +320,3 @@ var SourceStringIterator = (function (_super) { | ||
return SourceStringIterator; | ||
})(BufferedSourceReader); | ||
}(BufferedSourceReader)); | ||
exports.SourceStringIterator = SourceStringIterator; | ||
@@ -353,3 +354,3 @@ function Token(name, value) { | ||
return Tokenizer; | ||
})(); | ||
}()); | ||
exports.Tokenizer = Tokenizer; | ||
@@ -399,3 +400,3 @@ var TokenizerIterator = (function () { | ||
return TokenizerIterator; | ||
})(); | ||
}()); | ||
/** | ||
@@ -428,3 +429,3 @@ Recombine a stream of tokens using a stack of lists, e.g., | ||
return Combiner; | ||
})(); | ||
}()); | ||
exports.Combiner = Combiner; | ||
@@ -468,3 +469,3 @@ var CombinerIterator = (function () { | ||
return CombinerIterator; | ||
})(); | ||
}()); | ||
function MachineRule(regexp, callback) { | ||
@@ -546,3 +547,3 @@ return [regexp, callback]; | ||
return MachineState; | ||
})(); | ||
}()); | ||
exports.MachineState = MachineState; |
{ | ||
"name": "lexing", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Regex-based lexer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,3 +11,3 @@ import { Source } from './index'; | ||
1. If we do find needle, return the file's position of the first character of `needle`. | ||
2. If we reach EOF without finding it, return null. | ||
2. If we reach EOF without finding it, return undefined. | ||
*/ | ||
@@ -19,4 +19,4 @@ export declare function indexOf(source: Source, searchValue: string, fromIndex?: number, BLOCK_SIZE?: number): number; | ||
1. If we do find needle, return the file's position of the first character of `needle`. | ||
2. If we reach the beginning of the file before finding it, return null. | ||
2. If we reach the beginning of the file before finding it, return undefined. | ||
*/ | ||
export declare function lastIndexOf(source: Source, searchValue: string, fromIndex?: number, BLOCK_SIZE?: number): number; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var buffer_1 = require('./buffer'); | ||
@@ -6,3 +7,3 @@ /** | ||
1. If we do find needle, return the file's position of the first character of `needle`. | ||
2. If we reach EOF without finding it, return null. | ||
2. If we reach EOF without finding it, return undefined. | ||
*/ | ||
@@ -34,4 +35,4 @@ function indexOf(source, searchValue, fromIndex, BLOCK_SIZE) { | ||
var needle_haystack_index = buffer_1.indexOf(haystack, needle, haystack_search_offset); | ||
// needle_haystack_index, if not null, is the position of needle within haystack | ||
if (needle_haystack_index !== null) { | ||
// needle_haystack_index, if not undefined, is the position of needle within haystack | ||
if (needle_haystack_index !== undefined) { | ||
// we found it! | ||
@@ -41,4 +42,3 @@ return haystack_file_position + needle_haystack_index; | ||
} | ||
// we hit EOF before finding needle; return null | ||
return null; | ||
// we hit EOF before finding needle; return undefined | ||
} | ||
@@ -50,3 +50,3 @@ exports.indexOf = indexOf; | ||
1. If we do find needle, return the file's position of the first character of `needle`. | ||
2. If we reach the beginning of the file before finding it, return null. | ||
2. If we reach the beginning of the file before finding it, return undefined. | ||
*/ | ||
@@ -68,3 +68,3 @@ function lastIndexOf(source, searchValue, fromIndex, BLOCK_SIZE) { | ||
var last_index_of_needle_within_haystack = buffer_1.lastIndexOf(haystack, needle); | ||
if (last_index_of_needle_within_haystack !== null) { | ||
if (last_index_of_needle_within_haystack !== undefined) { | ||
// we found it! | ||
@@ -74,5 +74,4 @@ return position + last_index_of_needle_within_haystack; | ||
} | ||
// we hit EOF before finding needle; return null | ||
return null; | ||
// we hit EOF before finding needle; return undefined | ||
} | ||
exports.lastIndexOf = lastIndexOf; |
@@ -13,3 +13,3 @@ import assert from 'assert'; | ||
it('should not start with "other"', () => { | ||
assert.equal(compare(haystack, new Buffer('other')), false); | ||
assert.strictEqual(compare(haystack, new Buffer('other')), false); | ||
}); | ||
@@ -21,6 +21,6 @@ }); | ||
it('should have hello at index 0', () => { | ||
assert.equal(indexOf(haystack, new Buffer('hello')), 10); | ||
assert.strictEqual(indexOf(haystack, new Buffer('hello')), 10); | ||
}); | ||
it('should not have other at index 0', () => { | ||
assert.equal(indexOf(haystack, new Buffer('other')), null); | ||
assert.strictEqual(indexOf(haystack, new Buffer('other')), undefined); | ||
}); | ||
@@ -32,11 +32,11 @@ }); | ||
it('should equal hello at 0:5', () => { | ||
assert.equal(equalTo(haystack, new Buffer('hello'), 0, 5), true); | ||
assert.strictEqual(equalTo(haystack, new Buffer('hello'), 0, 5), true); | ||
}); | ||
it('should equal he at 0:2', () => { | ||
assert.equal(equalTo(haystack, new Buffer('he'), 0, 2), true); | ||
assert.strictEqual(equalTo(haystack, new Buffer('he'), 0, 2), true); | ||
}); | ||
it('should not equal world at index 0:5', () => { | ||
assert.equal(equalTo(haystack, new Buffer('world'), 0, 5), false); | ||
assert.strictEqual(equalTo(haystack, new Buffer('world'), 0, 5), false); | ||
}); | ||
}); | ||
}); |
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
53714
1161