(order, ch, sticky)
| 327 | |
| 328 | var bidiOther = null; |
| 329 | function getBidiPartAt(order, ch, sticky) { |
| 330 | var found; |
| 331 | bidiOther = null; |
| 332 | for (var i = 0; i < order.length; ++i) { |
| 333 | var cur = order[i]; |
| 334 | if (cur.from < ch && cur.to > ch) { return i } |
| 335 | if (cur.to == ch) { |
| 336 | if (cur.from != cur.to && sticky == "before") { found = i; } |
| 337 | else { bidiOther = i; } |
| 338 | } |
| 339 | if (cur.from == ch) { |
| 340 | if (cur.from != cur.to && sticky != "before") { found = i; } |
| 341 | else { bidiOther = i; } |
| 342 | } |
| 343 | } |
| 344 | return found != null ? found : bidiOther |
| 345 | } |
| 346 | |
| 347 | // Bidirectional ordering algorithm |
| 348 | // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm |
no outgoing calls
no test coverage detected