@defra/forms-model 3.0.291 → 3.0.292

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.291",
3
+ "version": "3.0.292",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -1,39 +1,5 @@
1
1
  import slug from 'slug'
2
2
 
3
- export const serialiseAndDeserialise = <T>(obj: T): T => {
4
- if (typeof obj === 'object' && obj !== null) {
5
- return JSON.parse(JSON.stringify(obj))
6
- }
7
-
8
- return obj
9
- }
10
-
11
- export const clone = <T>(obj: T & { clone?: () => T }): T => {
12
- if (obj) {
13
- if (typeof obj.clone === 'function') {
14
- return obj.clone()
15
- }
16
-
17
- return serialiseAndDeserialise<T>(obj)
18
- }
19
- return obj
20
- }
21
-
22
- export function filter<T extends Record<string, unknown>>(
23
- obj: T,
24
- predicate: (value: any) => boolean
25
- ): Partial<T> {
26
- const result = {}
27
-
28
- for (const [key, value] of Object.entries(obj)) {
29
- if (value && predicate(value)) {
30
- result[key] = value
31
- }
32
- }
33
-
34
- return result
35
- }
36
-
37
3
  /**
38
4
  * Replace whitespace, en-dashes and em-dashes with spaces
39
5
  * before running through the slug package