@enonic/js-utils
Advanced tools
Comparing version 0.25.0 to 0.25.1
@@ -273,3 +273,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -298,3 +298,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -301,0 +305,0 @@ return false; |
@@ -195,3 +195,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -220,3 +220,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -223,0 +227,0 @@ return false; |
@@ -152,3 +152,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -177,3 +177,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -180,0 +184,0 @@ return false; |
@@ -55,3 +55,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -80,3 +80,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -83,0 +87,0 @@ return false; |
@@ -83,3 +83,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -108,3 +108,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -111,0 +115,0 @@ return false; |
@@ -76,3 +76,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -101,3 +101,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -104,0 +108,0 @@ return false; |
@@ -37,3 +37,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -62,3 +62,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -65,0 +69,0 @@ return false; |
@@ -37,3 +37,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -40,0 +40,0 @@ } |
@@ -37,3 +37,3 @@ var __defProp = Object.defineProperty; | ||
function isGeoPointArray(v) { | ||
if (!Array.isArray(v)) { | ||
if (!Array.isArray(v) || v.length !== 2) { | ||
return false; | ||
@@ -62,3 +62,7 @@ } | ||
} | ||
const [lat, lon] = v.split(","); | ||
const array = v.split(","); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] = array; | ||
if (!isString(lat) || !isString(lon)) { | ||
@@ -65,0 +69,0 @@ return false; |
@@ -59,3 +59,3 @@ { | ||
}, | ||
"version": "0.25.0" | ||
"version": "0.25.1" | ||
} |
@@ -7,3 +7,6 @@ import type {GeoPointArray} from '../mock/value'; | ||
export function isGeoPointArray(v :GeoPointArray | unknown) :v is GeoPointArray { | ||
if (!Array.isArray(v)) { return false; } | ||
if ( | ||
!Array.isArray(v) | ||
|| v.length !== 2 // Even if the two first items are valid, if there are more items, it's not a GeoPointArray | ||
) { return false; } | ||
@@ -10,0 +13,0 @@ const [lat, lon] :number[] = v; |
@@ -10,4 +10,9 @@ import type {GeoPointString} from '../mock/value'; | ||
const [lat, lon] :string[] = (v as string).split(','); | ||
const array = (v as string).split(','); | ||
if (array.length !== 2) { | ||
return false; | ||
} | ||
const [lat, lon] :string[] = array; | ||
if (!isString(lat) || !isString(lon)) { return false; } | ||
@@ -14,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1427631
44856