Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ministryofjustice/fb-nunjucks-helpers

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ministryofjustice/fb-nunjucks-helpers - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

72

lib/fb-nunjucks-data-helpers.js

@@ -19,2 +19,10 @@ const Markdown = require('markdown-it')()

}
if (data[prop]) {
if (data._id) {
data[prop].attributes = {
'data-block-id': data._id,
'data-block-property': prop
}
}
}
return data

@@ -33,29 +41,45 @@ }

const setItemsLabel = data => {
data = setLabel(data)
data.legend = data.legend || data.label
data = checkPropObject(data, 'legend')
data.fieldset = data.fieldset || {}
if (data.legend) {
data.fieldset = Object.assign({}, data.fieldset, {
legend: data.legend
})
}
if (data.hint) {
data.fieldset = Object.assign({}, data.fieldset, {
hint: data.hint
})
}
try {
data = setLabel(data)
data.legend = data.legend || data.label
data = checkPropObject(data, 'legend')
data.fieldset = data.fieldset || {}
if (data.legend) {
data.fieldset = Object.assign({}, data.fieldset, {
legend: data.legend
}, {
attributes: data.legend.attributes
})
delete data.legend.attributes
}
if (data.hint) {
data.fieldset = Object.assign({}, data.fieldset, {
hint: data.hint
})
}
if (data.error) {
data.fieldset.errorMessage = {
html: data.error
if (data.error) {
data.fieldset.errorMessage = {
html: data.error
}
}
data = Object.assign(data, data.fieldset)
data.items = data.items || []
data.items = data.items.map(item => {
const updatedItem = Object.assign({}, item, {
text: item.text ? item.text : item.label
})
if (data._type !== 'date') {
updatedItem.label = {
attributes: {
'data-block-id': item._id,
'data-block-property': 'label'
}
}
}
return updatedItem
})
} catch (e) {
// console.log(e)
}
data = Object.assign(data, data.fieldset)
data.items = data.items || []
data.items = data.items.map(item => {
return Object.assign({}, item, {
text: item.text ? item.text : item.label
})
})
return data

@@ -62,0 +86,0 @@ }

{
"name": "@ministryofjustice/fb-nunjucks-helpers",
"version": "0.0.6",
"version": "0.0.7",
"description": "Form Builder Nunjucks helpers",

@@ -5,0 +5,0 @@ "main": "lib/fb-nunjucks-helpers.js",

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