$.object.remove

Remove method of array helpers

This remove helper is for remove object properties by its key or its name. Actually you can use delete statement to remove certain property from the object, but the problem is when we want to remove multiple properties from our object, that is why we provide this remove helper.

$.object.remove(fromObject, ...propertyKeys*)

// Example:
const fromObject = { 
  id: 1, 
  name: 'Tedir Ghazali', 
  office: 'Banda Aceh', 
  age: 29 
}
$.object.remove(fromObject, 'name', 'office')
//=> { id: 1, age: 29 }

Or you may want to remove object properties by its value, you can do that by using another helper which is removeBy helper, this will remove all the properties that have similar values.

$.object.removeBy(fromObject, ...propertyValues*)

// Example:
$.object.removeBy(fromObject, 1, 29)
//=> { name: 'Tedir Ghazali', office: 'Banda Aceh' }

Last updated