Socket
Socket
Sign inDemoInstall

@wmfs/cardscript-extract-defaults

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wmfs/cardscript-extract-defaults - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [1.3.0](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.2.0...v1.3.0) (2019-03-11)
### ✨ Features
* Add additional text-based elements. ([0c24a80](https://github.com/wmfs/cardscript-extract-defaults/commit/0c24a80))
* Fix editor bug and tests. ([126b4f0](https://github.com/wmfs/cardscript-extract-defaults/commit/126b4f0))
* Fix issue not passing default value through. ([a3a0715](https://github.com/wmfs/cardscript-extract-defaults/commit/a3a0715))
* Tweak for text editors. ([0fe7680](https://github.com/wmfs/cardscript-extract-defaults/commit/0fe7680))
# [1.2.0](https://github.com/wmfs/cardscript-extract-defaults/compare/v1.1.1...v1.2.0) (2019-02-28)

@@ -2,0 +12,0 @@

13

lib/index.js

@@ -69,2 +69,5 @@ module.exports = function extractDefaults (cardscript) {

case 'Input.Text':
case 'Input.Name':
case 'Input.Email':
case 'Input.TelephoneNumber':
case 'Input.Time':

@@ -86,3 +89,3 @@ case 'Input.ChoiceSet':

} else {
// not sure about this...
// TODO: not sure about this...
const apiLookupId = apiLookupPath[apiLookupPath.length - 1]

@@ -132,3 +135,3 @@ const cardListId = cardListPath[cardListPath.length - 1]

function extractDefaultValue ({ type, value, isMultiSelect }) {
function extractDefaultValue ({ type, value, isMultiSelect, editor }) {
let defaultValue = value

@@ -140,3 +143,4 @@

if (type === 'Input.Text' && value === undefined) {
if (!defaultValue && type === 'Input.Text' && editor) {
// Some text editors don't like being passed null...
defaultValue = ''

@@ -154,3 +158,6 @@ }

if (defaultValue === undefined) {
defaultValue = null
}
return defaultValue
}
{
"name": "@wmfs/cardscript-extract-defaults",
"description": "Extracts sensible defaults from some Cardscript.",
"version": "1.2.0",
"version": "1.3.0",
"author": "West Midlands Fire Service",

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

@@ -15,3 +15,3 @@ /* eslint-env mocha */

rootView: {
name: ''
name: null
},

@@ -27,15 +27,20 @@ cardLists: {}

{
cardLists: {},
rootView: {
base: 'TOMATO',
deliveryOrCollection: 'COLLECT',
dietaryReq: [],
dietaryReqOther: null,
firstName: null,
hot: false,
howHot: null,
lastName: null,
phoneNumber: null,
primaryFlavour: null,
savouryOrSweet: null,
secondaryFlavour: null,
size: 'M',
hot: false,
deliveryOrCollection: 'COLLECT',
sprinkles: false,
dietaryReq: [],
toppings: [],
dietaryReqOther: '',
firstName: '',
lastName: ''
},
cardLists: {}
toppings: []
}
}

@@ -52,13 +57,19 @@ )

choice: 'CHOICE_1',
choiceMulti: [ 'CHOICE_1', 'CHOICE_2' ],
choiceMulti: ['CHOICE_1', 'CHOICE_2'],
choiceWithTitle: 'CHOICE_1',
date: null,
email: null,
slider: 3,
text: '',
text: null,
time: null,
textEditor: 'editor: true',
inputAddressSearchResults: [],
inputSignatureOpenModal: false,
inputTelephoneNumber: null,
name: null,
number: null,
inputApiLookup: {
loading: false,
params: {
searchQuery: '',
searchQuery: null,
sortBy: 'MOST_RECENT'

@@ -95,10 +106,13 @@ },

starters: {
starterQuantity: 2
starterQuantity: 2,
starterType: null
},
pizzas: {
pizzaQuantity: 1,
dips: []
dips: [],
pizzaType: null
},
dips: {
dipQuantity: 3
dipQuantity: 3,
dipType: null
}

@@ -105,0 +119,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc