@defra/forms-model 3.0.700 → 3.0.701
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/utils/set-property.js +15 -0
- package/dist/module/utils/set-property.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/set-property.d.ts +8 -0
- package/dist/types/utils/set-property.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/utils/set-property.ts +20 -0
package/dist/module/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./manage/users.js";
|
|
|
29
29
|
export * from "./pages/index.js";
|
|
30
30
|
export * from "./utils/helpers.js";
|
|
31
31
|
export * from "./utils/markdown.js";
|
|
32
|
+
export * from "./utils/set-property.js";
|
|
32
33
|
export * from "./form/form-audit/index.js";
|
|
33
34
|
export * from "./form/form-audit/enums.js";
|
|
34
35
|
export * from "./form/form-audit/consolidation.js";
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/enums.js'\nexport * from '~/src/common/random-id.js'\nexport * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-definition/helpers.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-metrics/enums.js'\nexport * from '~/src/form/form-metrics/types.js'\nexport * from '~/src/form/form-metrics/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/form-submission/enums.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/enums.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-editor/preview/index.js'\nexport * from '~/src/form/form-editor/translations/translations-config.js'\nexport * from '~/src/form/form-editor/translations/translations.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/form/form-manager/errors.js'\nexport * from '~/src/manage/dead-letter-queues.js'\nexport * from '~/src/manage/roles.js'\nexport * from '~/src/manage/users.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\nexport * from '~/src/form/form-audit/index.js'\nexport * from '~/src/form/form-audit/enums.js'\nexport * from '~/src/form/form-audit/consolidation.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/preview/types.js'\nexport type * from '~/src/form/form-editor/types.js'\nexport type * from '~/src/form/form-editor/macros/types.js'\nexport type * from '~/src/form/form-audit/types.js'\nexport type * from '~/src/manage/types.js'\n\n// test\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/enums.js'\nexport * from '~/src/common/random-id.js'\nexport * from '~/src/common/schema.js'\nexport * from '~/src/common/pagination/index.js'\nexport * from '~/src/common/search/index.js'\nexport * from '~/src/common/sorting/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-definition/types.js'\nexport * from '~/src/form/form-definition/helpers.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-metrics/enums.js'\nexport * from '~/src/form/form-metrics/types.js'\nexport * from '~/src/form/form-metrics/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/form-submission/enums.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/form/form-editor/enums.js'\nexport * from '~/src/form/form-editor/index.js'\nexport * from '~/src/form/form-editor/preview/index.js'\nexport * from '~/src/form/form-editor/translations/translations-config.js'\nexport * from '~/src/form/form-editor/translations/translations.js'\nexport * from '~/src/form/form-manager/types.js'\nexport * from '~/src/form/form-manager/errors.js'\nexport * from '~/src/manage/dead-letter-queues.js'\nexport * from '~/src/manage/roles.js'\nexport * from '~/src/manage/users.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\nexport * from '~/src/utils/set-property.js'\nexport * from '~/src/form/form-audit/index.js'\nexport * from '~/src/form/form-audit/enums.js'\nexport * from '~/src/form/form-audit/consolidation.js'\n\nexport type * from '~/src/common/types.js'\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/common/search/types.js'\nexport type * from '~/src/common/sorting/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\nexport type * from '~/src/form/form-editor/preview/types.js'\nexport type * from '~/src/form/form-editor/types.js'\nexport type * from '~/src/form/form-editor/macros/types.js'\nexport type * from '~/src/form/form-audit/types.js'\nexport type * from '~/src/manage/types.js'\n\n// test\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter to be able to set an object property within a nunjucks file
|
|
3
|
+
* @param { object | undefined } obj - the object
|
|
4
|
+
* @param {string} propertyName - the property name
|
|
5
|
+
* @param {string | number | boolean | undefined} propertyValue - the property value
|
|
6
|
+
*/
|
|
7
|
+
export function setProperty(obj, propertyName, propertyValue) {
|
|
8
|
+
if (!obj || !propertyName) {
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
const typed = obj;
|
|
12
|
+
typed[propertyName] = propertyValue;
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=set-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-property.js","names":["setProperty","obj","propertyName","propertyValue","typed"],"sources":["../../../src/utils/set-property.ts"],"sourcesContent":["/**\n * Filter to be able to set an object property within a nunjucks file\n * @param { object | undefined } obj - the object\n * @param {string} propertyName - the property name\n * @param {string | number | boolean | undefined} propertyValue - the property value\n */\nexport function setProperty(\n obj: object | undefined,\n propertyName: string,\n propertyValue: string | number | boolean | undefined\n) {\n if (!obj || !propertyName) {\n return obj\n }\n\n const typed = obj as Record<string, string | number | boolean | undefined>\n typed[propertyName] = propertyValue\n\n return obj\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CACzBC,GAAuB,EACvBC,YAAoB,EACpBC,aAAoD,EACpD;EACA,IAAI,CAACF,GAAG,IAAI,CAACC,YAAY,EAAE;IACzB,OAAOD,GAAG;EACZ;EAEA,MAAMG,KAAK,GAAGH,GAA4D;EAC1EG,KAAK,CAACF,YAAY,CAAC,GAAGC,aAAa;EAEnC,OAAOF,GAAG;AACZ","ignoreList":[]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './manage/users.js';
|
|
|
29
29
|
export * from './pages/index.js';
|
|
30
30
|
export * from './utils/helpers.js';
|
|
31
31
|
export * from './utils/markdown.js';
|
|
32
|
+
export * from './utils/set-property.js';
|
|
32
33
|
export * from './form/form-audit/index.js';
|
|
33
34
|
export * from './form/form-audit/enums.js';
|
|
34
35
|
export * from './form/form-audit/consolidation.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,uCAAuC,CAAA;AACrD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,4DAA4D,CAAA;AAC1E,cAAc,qDAAqD,CAAA;AACnE,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wCAAwC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uB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wCAAwC,CAAA;AAEtD,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,+BAA+B,CAAA;AAClD,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA;AACtD,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,yCAAyC,CAAA;AAC5D,mBAAmB,iCAAiC,CAAA;AACpD,mBAAmB,wCAAwC,CAAA;AAC3D,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter to be able to set an object property within a nunjucks file
|
|
3
|
+
* @param { object | undefined } obj - the object
|
|
4
|
+
* @param {string} propertyName - the property name
|
|
5
|
+
* @param {string | number | boolean | undefined} propertyValue - the property value
|
|
6
|
+
*/
|
|
7
|
+
export declare function setProperty(obj: object | undefined, propertyName: string, propertyValue: string | number | boolean | undefined): object | undefined;
|
|
8
|
+
//# sourceMappingURL=set-property.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-property.d.ts","sourceRoot":"","sources":["../../../src/utils/set-property.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,sBAUrD"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from '~/src/manage/users.js'
|
|
|
29
29
|
export * from '~/src/pages/index.js'
|
|
30
30
|
export * from '~/src/utils/helpers.js'
|
|
31
31
|
export * from '~/src/utils/markdown.js'
|
|
32
|
+
export * from '~/src/utils/set-property.js'
|
|
32
33
|
export * from '~/src/form/form-audit/index.js'
|
|
33
34
|
export * from '~/src/form/form-audit/enums.js'
|
|
34
35
|
export * from '~/src/form/form-audit/consolidation.js'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter to be able to set an object property within a nunjucks file
|
|
3
|
+
* @param { object | undefined } obj - the object
|
|
4
|
+
* @param {string} propertyName - the property name
|
|
5
|
+
* @param {string | number | boolean | undefined} propertyValue - the property value
|
|
6
|
+
*/
|
|
7
|
+
export function setProperty(
|
|
8
|
+
obj: object | undefined,
|
|
9
|
+
propertyName: string,
|
|
10
|
+
propertyValue: string | number | boolean | undefined
|
|
11
|
+
) {
|
|
12
|
+
if (!obj || !propertyName) {
|
|
13
|
+
return obj
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const typed = obj as Record<string, string | number | boolean | undefined>
|
|
17
|
+
typed[propertyName] = propertyValue
|
|
18
|
+
|
|
19
|
+
return obj
|
|
20
|
+
}
|