Alga.js
  • Introduction
  • Installation
  • Array
    • $.array.insert
    • $.array.update
    • $.array.destroy
    • $.array.select
    • $.array.hidden
    • $.array.search
    • $.array.filter
    • $.array.paginate
    • $.array.sort
    • $.array.setOperations
    • $.array.sum
    • $.array.calculate
  • Object
    • $.object.remove
  • String & Char
    • $string.split
    • $.char.random
  • Number (Int & Float)
    • $.number.calc
    • $.number.currency
  • Date
    • $.date.now
    • $.date.format
    • $.date.parse
    • $.date.days
    • $.date.weeks
    • $.date.months
    • $date.calendar
Powered by GitBook
On this page
  1. Object

$.object.remove

Remove method of array helpers

Previous$.array.calculateNext$string.split

Last updated 3 years ago

Was this helpful?

CtrlK

Was this helpful?

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' }