ingeni-validation 1.1.8 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -310,7 +310,7 @@ async function isValidDate(value, format) {
310
310
 
311
311
  //Stop details Validation "stop_details":[{"30":["Baripada","13:00","13:01","21.9319,86.7465"]}]
312
312
 
313
- async function isValidStopDetails(stop_details){
313
+ async function isValidStopDetails(stop_details){
314
314
 
315
315
  if (!Array.isArray(stop_details) || stop_details.length === 0){
316
316
  return false;
@@ -362,13 +362,17 @@ async function isValidDate(value, format) {
362
362
  return false;
363
363
  }
364
364
 
365
- // arrival must be before departure
366
- if (toMinutes(arrival_time) >= toMinutes(departure_time)){
365
+ // arrival must be <= departure
366
+ if (toMinutes(arrival_time) > toMinutes(departure_time)){
367
367
  return false;
368
368
  }
369
369
 
370
- // lat,long validation
371
- if (typeof latlong !== "string" || !latlongRegex.test(latlong)){
370
+ // coordinates mandatory
371
+ if (typeof latlong !== "string" || latlong.trim().length === 0){
372
+ return false;
373
+ }
374
+
375
+ if (!latlongRegex.test(latlong)){
372
376
  return false;
373
377
  }
374
378
 
@@ -376,7 +380,6 @@ async function isValidDate(value, format) {
376
380
 
377
381
  if (lat < -90 || lat > 90) return false;
378
382
  if (lon < -180 || lon > 180) return false;
379
-
380
383
  }
381
384
 
382
385
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeni-validation",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "Ingeni Validation",
5
5
  "license": "ISC",
6
6
  "author": "",