-
Notifications
You must be signed in to change notification settings - Fork 0
removeLastN(arrayObject,n,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.removeLastN(obj,2)
console.log(obj)
//Output
//[ { name: 'abc', type: 'array', age: 20 },
// { name: 'pqr', type: 'string', age: 20 },
// { name: 'xyz', type: 'array', age: 22 } ]
//e.g. 2
daex.removeLastN(obj,2,{'type':'array'})
console.log(obj)
//Output
//[ { name: 'abc', type: 'array', age: 20 },
// { name: 'pqr', type: 'string', age: 20 },
// { name: 'mno', type: 'number', age: 20 } ]
//e.g. 3
daex.removeLastN(obj,2,{'type':'array','age':20})
console.log(obj)
//Output
//[ { name: 'pqr', type: 'string', age: 20 },
// { name: 'xyz', type: 'array', age: 22 },
// { name: 'mno', type: 'number', age: 20 } ]