selected-location.js (535B)
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 export function getSelectedLocation(mappedLocation, context) { 6 if (!context) { 7 return mappedLocation.location; 8 } 9 10 // `context` may be a location or directly a source object. 11 const source = context.source || context; 12 return source.isOriginal 13 ? mappedLocation.location 14 : mappedLocation.generatedLocation; 15 }