UNPKG

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