Skip to content

Longitude

Longitude value object.

Import

typescript
import { Longitude } from '@haskou/value-objects';

Signature

typescript
class Longitude extends NumberValueObject

Constructor

typescript
constructor(value: number | NumberValueObject)

Validation

Must be between -180 and 180, inclusive.

Throws

This class can throw:

  • InvalidLongitudeError

Example

typescript
import { Longitude } from '@haskou/value-objects';

const longitude = new Longitude(2.159);
longitude.valueOf(); // 2.159

Notes

  • Accepts primitive numbers and NumberValueObject instances.

Released under the MIT License.