UNPKG

1.03 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.IsLongitude = exports.isLongitude = exports.IS_LONGITUDE = void 0;
4const ValidateBy_1 = require("./ValidateBy");
5const IsLatLong_1 = require("./IsLatLong");
6exports.IS_LONGITUDE = 'isLongitude';
7/**
8 * Checks if a given value is a longitude.
9 */
10function isLongitude(value) {
11 return (typeof value === 'number' || typeof value === 'string') && (0, IsLatLong_1.isLatLong)(`0,${value}`);
12}
13exports.isLongitude = isLongitude;
14/**
15 * Checks if a given value is a longitude.
16 */
17function IsLongitude(validationOptions) {
18 return (0, ValidateBy_1.ValidateBy)({
19 name: exports.IS_LONGITUDE,
20 validator: {
21 validate: (value, args) => isLongitude(value),
22 defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a longitude string or number', validationOptions),
23 },
24 }, validationOptions);
25}
26exports.IsLongitude = IsLongitude;
27//# sourceMappingURL=IsLongitude.js.map
\No newline at end of file