Js array processing

  1. the array is as follows
[
{"admin":0,"del":6,"download":0,"move":16,"rename":0,"upload":0},
{"admin":0,"del":0,"download":2,"move":16,"rename":0,"upload":4},
{"admin":0,"del":0,"download":2,"move":16,"rename":0,"upload":0}
]

process the array, in the object of each item, for example, return true, if admin is all greater than 0, otherwise return false

["admin":false,"del":false,"download":false,"move":true,"rename":false,"upload":false
]

is there a good way to deal with

Thank you.

Nov.17,2021

var a = [
{'admin':0,'del':6,'download':0,'move':'16','rename':0,'upload':0},
{'admin':0,'del':0,'download':2,'move':'16','rename':0,'upload':4},
{'admin':0,'del':0,'download':2,'move':'16','rename':0,'upload':0}
],
result = {'admin':true,'del':true,'download':true,'move':true,'rename':true,'upload':true}

var falseRes = a.reduce((sum = {}, item) => {
    var keys = Object.keys(item)
    let temp = {}
    keys.forEach((key) => {
        if (item[key] <= 0) {
            temp[key] = false
        }
    })
    console.log('temp', temp)
    Object.assign(sum, temp)
    return sum
},{})

Object.assign(result, falseRes)


every()

const arr=[
{'admin':0,'del':6,'download':0,'move':16,'rename':0,'upload':0},
{'admin':0,'del':0,'download':2,'move':16,'rename':0,'upload':4},
{'admin':0,'del':0,'download':2,'move':16,'rename':0,'upload':0}
]

const result=arr.every(item=>item.admin>0) //result 
Menu