@wmfs/cardscript-extract-defaults
Advanced tools
Comparing version 1.7.1 to 1.8.0
@@ -0,1 +1,8 @@ | ||
# [1.8.0](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.7.1...v1.8.0) (2019-08-06) | ||
### ✨ Features | ||
* allow enter map coords ([2798e3b](https://github.com/wmfs/cardscript-extract-defaults/commit/2798e3b)) | ||
## [1.7.1](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.7.0...v1.7.1) (2019-07-23) | ||
@@ -2,0 +9,0 @@ |
@@ -178,2 +178,35 @@ module.exports = function extractDefaults (cardscript) { | ||
break | ||
case 'Map': | ||
case 'Input.Map': | ||
const markers = element.markers ? [...element.markers] : [] | ||
if (element.centre && element.centre.show) markers.push(element.centre) | ||
for (const [idx] of markers.entries()) { | ||
const id_ = `MAP_PROMPT_${idx}` | ||
const defaultValue_ = { | ||
show: false, | ||
lat: null, | ||
lng: null | ||
} | ||
if (cardListPath.length === 0) { | ||
if (apiLookupPath.length === 0) { | ||
defaultValues.rootView[id_] = defaultValue_ | ||
} else { | ||
const apiLookupId = apiLookupPath[apiLookupPath.length - 1] | ||
defaultValues.rootView[apiLookupId].params[id_] = defaultValue_ | ||
} | ||
} else { | ||
if (apiLookupPath.length === 0) { | ||
const cardListId = cardListPath[cardListPath.length - 1] | ||
defaultValues.cardLists[cardListId][id_] = defaultValue_ | ||
} else { | ||
// TODO: not sure about this... | ||
const apiLookupId = apiLookupPath[apiLookupPath.length - 1] | ||
const cardListId = cardListPath[cardListPath.length - 1] | ||
defaultValues.cardLists[apiLookupId].params[cardListId][id_] = defaultValue_ | ||
} | ||
} | ||
} | ||
break | ||
} | ||
@@ -180,0 +213,0 @@ } |
{ | ||
"name": "@wmfs/cardscript-extract-defaults", | ||
"description": "Extracts sensible defaults from some Cardscript.", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"author": "West Midlands Fire Service", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23860
371