-
Notifications
You must be signed in to change notification settings - Fork 0
Empty fields
natlibfi-arlehiko edited this page Oct 2, 2018
·
4 revisions
This validator removes fields that have no values:
- Data-fields:
subfields.length === 0
- Data-field subfields:
$.fields[*].subfields[?(value.length === 0)]
- Only empty subfields are removed. Whole field is removed only if all of it's subfields have zero-length values
This is validator serves no purpose if @natlibfi/marc-record is run on default (strict) validation settings.
{
"fields": [
{
"tag": "001",
"value": "1234567"
},
{
"tag": "008",
"value": "98867273672367213"
},
{
"tag": "245",
"subfields": [
{
"code": "a",
"value": "foo"
},
{
"code": "b",
"value": "bar"
}
]
},
{
"tag": "500",
"subfields": [
{
"code": "a",
"value": "foobar"
}
]
}
]
}
{
"fields": [
{
"tag": "001",
"value": "1234567"
},
{
"tag": "008",
"value": ""
},
{
"tag": "245",
"subfields": [
{
"code": "a",
"value": "foo"
},
{
"code": "b",
"value": ""
}
]
},
{
"tag": "500",
"subfields": []
}
]
}