-
Notifications
You must be signed in to change notification settings - Fork 0
removeFirst(arrayObject,query)
Bhumil Sarvaiya edited this page Aug 31, 2017
·
1 revision
//common data
var daex = require('./index')
var obj = [
{
name: 'abc',
type: 'array',
age: 20
},
{
name: 'pqr',
type: 'string',
age: 20
},
{
name: 'xyz',
type: 'array',
age: 22
},
{
name: 'ghi',
type: 'array',
age: 20
},
{
name: 'mno',
type: 'number',
age: 20
}
]
//e.g. 1
daex.removeFirst(obj)
console.log(obj)
//Output
//[ { name: 'pqr', type: 'string', age: 20 },
// { name: 'xyz', type: 'array', age: 22 },
// { name: 'ghi', type: 'array', age: 20 },
// { name: 'mno', type: 'number', age: 20 } ]
//e.g. 2
daex.removeFirst(obj,{'type':'string'})
console.log(obj)
//Output
//[ { name: 'abc', type: 'array', age: 20 },
// { name: 'xyz', type: 'array', age: 22 },
// { name: 'ghi', type: 'array', age: 20 },
// { name: 'mno', type: 'number', age: 20 } ]
//e.g. 3
daex.removeFirst(obj,{'type':'array','age':22})
console.log(obj)
//Output
//[ { name: 'abc', type: 'array', age: 20 },
// { name: 'pqr', type: 'string', age: 20 },
// { name: 'ghi', type: 'array', age: 20 },
// { name: 'mno', type: 'number', age: 20 } ]