Make proj~get simpler and faster
This commit is contained in:
@@ -156,14 +156,9 @@ export function addProjections(projections) {
|
||||
* @api
|
||||
*/
|
||||
export function get(projectionLike) {
|
||||
let projection = null;
|
||||
if (projectionLike instanceof Projection) {
|
||||
projection = projectionLike;
|
||||
} else if (typeof projectionLike === 'string') {
|
||||
const code = projectionLike;
|
||||
projection = projections.get(code);
|
||||
}
|
||||
return projection;
|
||||
return typeof projectionLike === 'string' ?
|
||||
projections.get(/** @type {string} */ (projectionLike)) :
|
||||
(/** @type {module:ol/proj/Projection} */ (projectionLike) || null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user