I have a JavaScript object with several properties:
{
banking: {
account_number: null,
account_type: null,
bank_name: null,
debit_day: null
},
fitment: {
date: null,
terms: null
},
personal_info: {
email: null,
IDNumber: null,
mobile: null,
name: null,
residential_address: null,
surname: null,
title: null,
work_address: null,
work_tel: null
},
vehicle: {
brand: null,
colour: null,
model: null,
registration: null,
vin: null,
year: null
}
}
All top level properties and nested properties has default value of null.
I'm trying to figure out a way to categorize the properties into three groups, namely:
empty, partial and complete.
"empty" being a case that all values within a section are set as null.
"partial" being that some values within a section have been set (not all null)
"complete" being that no values within a section are set to null. All have values.
My first attempt was with utilizing the Underscore library with _.some(), however I can't seem to wrap my head around catering for all group scenarios.
Some help and guidance will be much appreciated.
Thanks!