Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create object filter

const reducedfilter =(data, keys, func)=>{
	data.filter(func).map(el =>{
    	keys.reduce((acc, key)=>{
          acc[key] = el[key];
          return acc
        },{})
     )
}
       
reducefilter(data, ['id', 'name'], item => item.age > 24)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #object #filter
ADD COMMENT
Topic
Name
4+2 =