
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Aggsy is a aggregation language/module for easy use in http query strings
Try it online at https://aggsyplay.reminyborg.com
You need npm installed:
$ npm install aggsy
var aggsy = require('aggsy')
var cars = [
{ model: 'volvo', make: 'v50', km: 100 },
{ model: 'tesla', make: 's', km: 200 },
{ model: 'tesla', make: 's', km: 120 },
{ model: 'tesla', make: 'x', km: 10 }
]
aggsy('model(distance: _sum(km), reports: _count())', cars)
// Gives:
{
tesla: { reports: 2, distance: 330 },
volvo: { reports: 1, distance: 100 }
}
// You may also flatten the results
aggsy('model(distance: _sum(km), reports: _count())', cars, { flatten: true })
// Gives:
[
{ model: 'tesla', reports: 2, distance: 330 },
{ model: 'volvo', reports: 1, distance: 100 }
]
To aggregate on nested groups
aggsy('model(make(count: _count()), count: _count())', cars)
// Gives:
{
tesla: {
's': { 'count': 2 },
'x': { 'count': 1 },
'count': 3
},
volvo: {
'v50': { 'count': 1 },
'count': 1
}
}
// Flatten
aggsy('model(make(count: _count()), 'make.count': _count())', cars, { flatten: true })
// Gives:
[
{ model: 'tesla' make: 's', 'make.count': 2, count: 3 },
{ model: 'tesla' make: 'x', 'make.count': 1, count: 3 },
{ model: 'volvo': make: 'v50', 'make.count': 1, count: 1 }
}
When run with an aggsy query and array of objects the aggregated results is returned.
When run with only an query will return an [aggregate function](#advanced use)
Following options are available:
reducers
- optional list of [custom reducers](#custom reducers)missing
- (default: false
) grouping name to put items where grouping property does not exitsflatten
- (default: false
) flatten result (may also be set with _flatten(query)
)Given a structure
{ model: 'volvo', details: { make: 'v50' }, km: 100 }
To group on model
use `model()``
{ volvo: [/* items with model: volvo */] }
To group on make
use dot notation `details.make()``
{ v50: [/* items with details.make: v50 */] }
If no reducers or nested groups are defined within a group ex: model()
all the items are returned in the groups
_flatten(query)
Sets the flatten value so you get flat results
_sum(property) Int
_count() Int
_min(property) Int
_max(property) Int
_first(property)
_last(property)
_has(property) Bool
_avg(property) { value: 0, count: 0 }
_stdev(property) { value: 0, variance: 0, average: 0, count: 0 }
_static(string) String
If only supplied with _sum(km)
the result would be { '_sum(km)': 100 }
Reducers can be named with the convention distance: _sum(km)
the result then would be { 'distance': 100 }
You can add a list of custom reducers to the aggsy options
object.
A reducer function behaves like javascript reduce
but only the previousValue
and currentValue
is supplied to the reducer function.
If you want to define an initialValue
it must be added as a function property.
function _myownsum (prev, curr) { return prev + curr }
_myownsum.initialValue = 0
var options = { reducers: { '_myowsum': _myowsum } }
aggsy('_myownsum(km)', data, options)
// or
var aggregate = aggsy('_myownsum(km)', options)
MIT
FAQs
Aggregation language for easy use in http query strings
The npm package aggsy receives a total of 6 weekly downloads. As such, aggsy popularity was classified as not popular.
We found that aggsy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.