How to use the isLongitude function from validator

Find comprehensive JavaScript validator.isLongitude code examples handpicked from public code repositorys.

38
39
40
41
42
43
44
45
46
  // Turn "a,b" into an array instead of a string
  if (typeof value === 'string') value = value.split(',');

  if (!_.isArray(value)) return false;

  return validator.isLongitude(value[0]) && validator.isLatitude(value[1]);
});
validator.extend('isLatitude', (value) => validator.isFloat(value) && value >= -90 && value <= 90);
validator.extend('isLongitude', (value) => validator.isFloat(value) && value >= -180 && value <= 180);
fork icon5
star icon7
watch icon2

+ 3 other calls in file