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 alligator.io #
 
PREVIOUS NEXT
Tagged: #create #object #filter
ADD COMMENT
Topic
Name
5+5 =