This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function handleSuffix(word, patterns) { | |
var wordLen = word.length; | |
for (var i = 0, len = patterns.length; i < len; i++) { | |
if (patterns[i][0].test(word)) { | |
if (wordLen - patterns[i][3] < patterns[i][2]) { | |
// The given suffix does not fit in the required region. | |
return word; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function search(key, data) { | |
var min = 0; | |
var max = data.length - 1; | |
var half; | |
while (max >= min) { | |
half = Math.floor((max + min)/2); | |
if (data[half] === key) { | |
return half; |
OlderNewer