tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

breakpointPositions.js (595B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 import { comparePosition } from "../location";
      6 import { getSelectedLocation } from "../selected-location";
      7 
      8 export function findPosition(positions, location) {
      9  if (!positions) {
     10    return null;
     11  }
     12 
     13  const lineBps = positions[location.line];
     14  if (!lineBps) {
     15    return null;
     16  }
     17  return lineBps.find(pos =>
     18    comparePosition(getSelectedLocation(pos, location), location)
     19  );
     20 }