New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ministryofjustice/fb-nunjucks-helpers

Package Overview
Dependencies
Maintainers
9
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.21 to 0.0.22

.dependabot/config.yml

5

lib/fb-nunjucks-data-helpers.js

@@ -17,2 +17,3 @@ const Markdown = require('markdown-it')()

const checkPropObject = (data, prop) => {
data = JSON.parse(JSON.stringify(data))
if (data[prop] && typeof data[prop] === 'string') {

@@ -25,6 +26,6 @@ data[prop] = {

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

@@ -31,0 +32,0 @@ }

37

lib/fb-nunjucks-data-helpers.unit.spec.js

@@ -75,15 +75,42 @@ const test = require('tape')

const labelData = setLabel({
label: 'labelValue'
label: 'labelValue',
_id: 'labelId'
})
t.equals(labelData.label.html, 'labelValue', 'it should set the label.html property with the value of any flat label passed')
t.deepEquals(labelData.label.attributes, {
'data-block-id': 'labelId',
'data-block-property': 'label'
}, 'it should set the expected data-block- properties on the attributes of any flat label passed')
const nestedLabelData = setLabel({
label: {
html: 'nestedLabelValue'
}
html: 'nestedLabelValue',
attributes: {
foo: 'bar'
}
},
_id: 'labelId'
})
t.deepEquals(nestedLabelData.label, {
html: 'nestedLabelValue'
}, 'it should let an explicitly passed label object property pass through untouched')
html: 'nestedLabelValue',
attributes: {
foo: 'bar',
'data-block-id': 'labelId',
'data-block-property': 'label'
}
}, 'it should let an explicitly passed label object property pass through adding only the expected data-block- properties')
const labelItemsData = setItemsLabel(setLabel({
label: 'labelItemsValue',
_id: 'labelId'
}))
t.deepEquals(labelItemsData.label, {
html: 'labelItemsValue',
attributes: {
'data-block-id': 'labelId',
'data-block-property': 'label'
}
}, 'it should not overwrite the label atttributes when calling setItemsLabel')
const hintData = setLabel({

@@ -90,0 +117,0 @@ hint: 'hintValue'

@@ -43,3 +43,3 @@

// let macroNjk = macroPath.replace(/.*\/(.+)\.njk?$/, '$1')
let macroNjk = macroPath.replace(/.*\/(.+)\.njk$/, '$1')
const macroNjk = macroPath.replace(/.*\/(.+)\.njk$/, '$1')
const macroNamespaceSuffix = macroNjk.includes('.') ? macroNjk.replace(/\.[^.]+$/, '') : ''

@@ -67,3 +67,3 @@ if (macroNamespaceSuffix) {

// Object to store macros in
let macros = {}
const macros = {}

@@ -75,3 +75,3 @@ const addMacro = (key, val) => {

const addMacros = (obj, namespace) => {
let newMacros = Object.assign({}, obj)
const newMacros = Object.assign({}, obj)
if (namespace) {

@@ -78,0 +78,0 @@ Object.keys(newMacros).forEach(key => {

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

@@ -10,3 +10,3 @@ "main": "lib/fb-nunjucks-helpers.js",

"devDependencies": {
"@ministryofjustice/eslint-config-fb": "^1.0.7",
"@ministryofjustice/eslint-config-fb": "^1.1.0",
"npm-run-all": "^4.1.5",

@@ -19,3 +19,3 @@ "tape": "^4.11.0"

"lodash.set": "^4.3.2",
"markdown-it": "^9.0.0",
"markdown-it": "^9.1.0",
"nunjucks": "^3.2.0"

@@ -22,0 +22,0 @@ },

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