Skip to content

Commit

Permalink
refacto(Crs): rename toUnit to getUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
Desplandis committed Nov 16, 2024
1 parent 69e8bd7 commit ca2f245
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Core/Geographic/Crs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function unitFromProj4Unit(proj: ProjectionDefinition) {
* @param crs - The CRS to extract the unit from.
* @returns Either `UNIT.METER`, `UNIT.DEGREE` or `undefined`.
*/
export function toUnit(crs: ProjectionLike) {
export function getUnit(crs: ProjectionLike) {
mustBeString(crs);
const p = proj4.defs(formatToEPSG(crs));
if (!p) {
Expand All @@ -134,7 +134,7 @@ export function toUnit(crs: ProjectionLike) {
* @throws {@link Error} if the CRS is not valid.
*/
export function isMetricUnit(crs: ProjectionLike) {
return (toUnit(crs) == UNIT.METER);
return getUnit(crs) === UNIT.METER;
}

/**
Expand All @@ -144,7 +144,7 @@ export function isMetricUnit(crs: ProjectionLike) {
* @throws {@link Error} if the CRS is not valid.
*/
export function isGeographic(crs: ProjectionLike) {
return (toUnit(crs) == UNIT.DEGREE);
return getUnit(crs) === UNIT.DEGREE;
}

/**
Expand Down

0 comments on commit ca2f245

Please sign in to comment.