@phosphor/algorithm
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/*----------------------------------------------------------------------------- | ||
@@ -8,3 +9,2 @@ | Copyright (c) 2014-2017, PhosphorJS Contributors | ||
|----------------------------------------------------------------------------*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -11,0 +11,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/*----------------------------------------------------------------------------- | ||
@@ -8,3 +9,2 @@ | Copyright (c) 2014-2017, PhosphorJS Contributors | ||
|----------------------------------------------------------------------------*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -11,0 +11,0 @@ /** |
@@ -12,2 +12,4 @@ /** | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The matched indices, or `null` if there is no match. | ||
@@ -24,3 +26,3 @@ * | ||
*/ | ||
function findIndices(source: string, query: string): number[] | null; | ||
function findIndices(source: string, query: string, start?: number): number[] | null; | ||
/** | ||
@@ -51,2 +53,4 @@ * The result of a string match function. | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The match result, or `null` if there is no match. | ||
@@ -66,3 +70,3 @@ * A lower `score` represents a stronger match. | ||
*/ | ||
function matchSumOfSquares(source: string, query: string): IMatchResult | null; | ||
function matchSumOfSquares(source: string, query: string, start?: number): IMatchResult | null; | ||
/** | ||
@@ -75,2 +79,4 @@ * A string matcher which uses a sum-of-deltas algorithm. | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The match result, or `null` if there is no match. | ||
@@ -90,3 +96,3 @@ * A lower `score` represents a stronger match. | ||
*/ | ||
function matchSumOfDeltas(source: string, query: string): IMatchResult | null; | ||
function matchSumOfDeltas(source: string, query: string, start?: number): IMatchResult | null; | ||
/** | ||
@@ -93,0 +99,0 @@ * Highlight the matched characters of a source text. |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/*----------------------------------------------------------------------------- | ||
@@ -8,3 +9,2 @@ | Copyright (c) 2014-2017, PhosphorJS Contributors | ||
|----------------------------------------------------------------------------*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -23,2 +23,4 @@ /** | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The matched indices, or `null` if there is no match. | ||
@@ -35,5 +37,6 @@ * | ||
*/ | ||
function findIndices(source, query) { | ||
function findIndices(source, query, start) { | ||
if (start === void 0) { start = 0; } | ||
var indices = new Array(query.length); | ||
for (var i = 0, j = 0, n = query.length; i < n; ++i, ++j) { | ||
for (var i = 0, j = start, n = query.length; i < n; ++i, ++j) { | ||
j = source.indexOf(query[i], j); | ||
@@ -55,2 +58,4 @@ if (j === -1) { | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The match result, or `null` if there is no match. | ||
@@ -70,4 +75,5 @@ * A lower `score` represents a stronger match. | ||
*/ | ||
function matchSumOfSquares(source, query) { | ||
var indices = findIndices(source, query); | ||
function matchSumOfSquares(source, query, start) { | ||
if (start === void 0) { start = 0; } | ||
var indices = findIndices(source, query, start); | ||
if (!indices) { | ||
@@ -78,3 +84,3 @@ return null; | ||
for (var i = 0, n = indices.length; i < n; ++i) { | ||
var j = indices[i]; | ||
var j = indices[i] - start; | ||
score += j * j; | ||
@@ -92,2 +98,4 @@ } | ||
* | ||
* @param start - The index to start the search. | ||
* | ||
* @returns The match result, or `null` if there is no match. | ||
@@ -107,4 +115,5 @@ * A lower `score` represents a stronger match. | ||
*/ | ||
function matchSumOfDeltas(source, query) { | ||
var indices = findIndices(source, query); | ||
function matchSumOfDeltas(source, query, start) { | ||
if (start === void 0) { start = 0; } | ||
var indices = findIndices(source, query, start); | ||
if (!indices) { | ||
@@ -114,3 +123,3 @@ return null; | ||
var score = 0; | ||
var last = -1; | ||
var last = start - 1; | ||
for (var i = 0, n = indices.length; i < n; ++i) { | ||
@@ -117,0 +126,0 @@ var j = indices[i]; |
{ | ||
"name": "@phosphor/algorithm", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "PhosphorJS - Algorithms and Iterators", | ||
@@ -17,2 +17,3 @@ "main": "lib/index.js", | ||
"rimraf": "^2.5.2", | ||
"typedoc": "^0.6.0", | ||
"typescript": "^2.2.1" | ||
@@ -22,3 +23,4 @@ }, | ||
"build": "tsc", | ||
"clean": "rimraf lib" | ||
"clean": "rimraf lib", | ||
"docs": "typedoc --options tdoptions.json ." | ||
}, | ||
@@ -25,0 +27,0 @@ "repository": { |
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
155508
4731
3