
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
array-aggregate
Advanced tools
yarn add array-aggregate
import { makeQueryFilter } from 'array-aggregate'
const filterFn = makeQueryFilter({
tags: 'bar',
'history.creator': 1, // User Id
})
console.log(
filterFn({
tags: ['foo', 'bar', 'etc'],
history: [
{
creator: 0,
},
{
creator: 1,
},
],
}),
) // true
console.log(
filterFn({
tags: ['foo', 'etc'],
history: [
{
creator: 0,
},
{
creator: 1,
},
],
}),
) // false
console.log(
filterFn({
tags: ['foo', 'bar', 'etc'],
history: [
{
creator: 0,
},
],
}),
) // false
Check that value is equal to some in query. Work with array, string, number, Date, boolean
Check that value is greater than some in query. Work with number, Date
Check that value is greater than or equal some in query. Work with number, Date
Check that value is less than some in query. Work with number, Date
Check that value is less than or equal some in query. Work with number, Date
Check that value is not equal some in query. Work with array, string, number, Date, boolean
Check that value is a member of some in query. Work with array, string, number
Check that value is not a member of some in query. Work with array, string, number
Check that all matches are true
Check that at least one matches are true
Check that all matches are false
Negotiate inner condition result
If it's true
we will check that needed field exists in object, if it's false
we will check that needed field is not inside object
Check that all elements from rule are present in value.
Check that array or string have needed length
Apply some rule to array elements
import { makeQueryFilter } from 'array-aggregate'
const secondQuery = makeQueryFilter({
foo: {
$eq: 'bar',
$exists: true,
},
createdAt,
ololo: {
a: {
$exists: false,
},
},
a: {
b: {
c: {
$lte: 1,
},
},
},
'a[0].b.c': {
// We can use path for accesing fields with index selection if it's needed
$gte: 1,
},
})
console.log(
secondQuery({
foo: ['bar', 'test'],
createdAt,
a: [
{
b: [
{
c: 1,
},
],
},
],
}),
) // true
FAQs
Mongo-like aggregate for arrays
The npm package array-aggregate receives a total of 2 weekly downloads. As such, array-aggregate popularity was classified as not popular.
We found that array-aggregate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.