const matchProperty = (data, compare) => {
let compareIn = Object.keys(compare)
let inData = Object.keys(data)
const newInData = inData
.slice(0, compareIn.length)
.map((v, i) => {
if (v !== compareIn[i]) {
return compareIn[i]
}
})
.map((v) => v !== undefined && true)
return newInData.includes(true) ? false : true
}
let data = { directory: null, pattern: null, fileName: null, extension: null }
let compare = { directory: null, patternx: null }
let res = matchProperty(data, compare)
console.log(res)