Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@iyulab/data-summerizer
Advanced tools
This library provides a simplified simulation of MongoDB's aggregation framework in TypeScript. It allows for filtering, grouping, sorting, and limiting of in-memory data collections, mimicking the behavior of database operations but in a lightweight, local context.
To use the Data Aggregator library in your project, you can install it via npm. Run the following command in your project directory:
npm install @iyulab/data-summerizer
Make sure you have Node.js and npm installed on your system. You can download and install Node.js (npm included) from https://nodejs.org/.
The Data Aggregator library provides the following features:
Filtering ($match): Filter your data based on specified criteria. Grouping and Aggregation ($group): Group your data by specific fields and count the number of documents in each group. Sorting ($sort): Sort your data based on one or more fields. Limiting ($limit): Limit the number of documents to return. Usage Below is a simple example demonstrating how to use the Aggregation class to perform data operations:
import { aggregation, AggregationOptions } from "@iyulab/data-summerizer";
// Sample data
const data = [
{ id: 1, name: "Alice", age: 30 },
{ id: 2, name: "Bob", age: 25 },
{ id: 3, name: "Charlie", age: 35 },
{ id: 4, name: "David", age: 40 },
];
// Create an instance of Aggregation with options
const options: AggregationOptions = {
$match: { age: { $gt: 30 } }, // Filtering: age greater than 30
$group: { _id: "$age" }, // Grouping by age
$sort: { age: 1 }, // Sorting by age in ascending order
$limit: 2, // Limiting to 2 documents
};
// Execute the aggregation
const result = aggregation(data, options);
console.log(result);
This will output the processed data based on the provided aggregation options. See Aggregation Tests
Contributions are welcome! Please feel free to submit pull requests or open issues to improve the library or add new features.
This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
Summarize the data.
The npm package @iyulab/data-summerizer receives a total of 0 weekly downloads. As such, @iyulab/data-summerizer popularity was classified as not popular.
We found that @iyulab/data-summerizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.