Socket
Socket
Sign inDemoInstall

@wmfs/cardscript-extract-defaults

Package Overview
Dependencies
0
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.7.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.7.0](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.6.0...v1.7.0) (2019-07-22)
### ✨ Features
* allow for Input.ApiLookup results card ([0a1d5cc](https://github.com/wmfs/cardscript-extract-defaults/commit/0a1d5cc))
# [1.6.0](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.5.0...v1.6.0) (2019-07-18)

@@ -2,0 +9,0 @@

36

lib/index.js

@@ -43,9 +43,15 @@ module.exports = function extractDefaults (cardscript) {

apiLookupPath.push(element.id)
defaultValues.rootView[element.id].params = {}
if (element.parametersCard) {
apiLookupPath.push(element.id)
defaultValues.rootView[element.id].params = {}
element.parametersCard.body.forEach(parseElement)
apiLookupPath.pop()
}
if (element.resultsCard) {
element.resultsCard.body.forEach(parseElement)
}
apiLookupPath.pop()
if (element.selectionType === 'single') {

@@ -144,2 +150,26 @@ defaultValues.rootView[element.id].selected = {}

break
case 'List':
if (element.selectionType === 'single' || element.selectionType === 'multi') {
const defaultValue = element.selectionType === 'single' ? {} : []
if (cardListPath.length === 0) {
if (apiLookupPath.length === 0) {
defaultValues.rootView[element.id] = defaultValue
} else {
const apiLookupId = apiLookupPath[apiLookupPath.length - 1]
defaultValues.rootView[apiLookupId].params[element.id] = defaultValue
}
} else {
if (apiLookupPath.length === 0) {
const cardListId = cardListPath[cardListPath.length - 1]
defaultValues.cardLists[cardListId][element.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][element.id] = defaultValue
}
}
}
break
}

@@ -146,0 +176,0 @@ }

2

package.json
{
"name": "@wmfs/cardscript-extract-defaults",
"description": "Extracts sensible defaults from some Cardscript.",
"version": "1.6.0",
"version": "1.7.0",
"author": "West Midlands Fire Service",

@@ -6,0 +6,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc