Apart
@apart-tech
Utilities and other helper functions built by Apart
Actions (3)
The array paginator is a function that divides a large array into smaller chunks, allowing you to display only a specific portion (or “page”) of the array at a time. It takes in parameters like the number of items you want per page (per_page) and the current page (page), and returns a portion of the array corresponding to that page.
This is useful if you are working with Redis lists, need to break apart a large dataset into smaller chunks for loops and more.
In addition to the paginated items, it also calculates useful metadata, such as:
• The total number of items in the array.
• The total number of pages.
• The current page.
• The next page (if there is one).
• The previous page (if there is one).
This allows for easier navigation through large datasets by breaking them up into smaller, manageable “pages.”
Utilities
Updated 1 day ago
Reduce the size of an array by 60% to 70%
On average the size of any array of objects (non nested) will be reduced by 60% to 70%
The Columnar Compression Algorithm restructures an array of objects by transforming it from a row-oriented structure (where each object repeats its keys) to a column-oriented format, where the values corresponding to each key are grouped together. This transformation reduces metadata overhead, improves data access efficiency, and can lead to space savings, especially when the array contains many records with the same set of keys.
The compressed array can then be transmitted and reconstructed at it´s destination.
Example:
`
[
{
"first_name": "Emma",
"last_name": "Rodriguez",
"email": "emma.rodriguez@mail.com",
"phone": "555-454-7896"
},
{
"first_name": "Chris",
"last_name": "Garcia",
"email": "chris.garcia@test.com",
"phone": "666-800-2436"
},
{
"first_name": "Jane",
"last_name": "Martinez",
"email": "jane.martinez@domain.com",
"phone": "555-331-4091"
}
// ... more objects
]
`
Will be compressed into:
`
{
"first_name": ["Emma", "Chris", "Jane"],
"last_name": ["Rodriguez", "Garcia", "Martinez"],
"email": ["emma.rodriguez@mail.com", "chris.garcia@test.com", "jane.martinez@domain.com"],
"phone": ["555-454-7896", "666-800-2436", "555-331-4091"],
"keys": ["firstname", "lastname", "email", "phone"]
}
`
Utilities
Updated 3 days ago
The Sort & Paginate action breaks a large array into smaller chunks, displaying only a specific “page” at a time. You specify the number of items per page (per_page) and the current page (page), and it returns that portion of the array. This is useful for handling large datasets, such as Redis lists, in loops.
In addition to paginated items, it provides metadata like:
• Total items
• Total pages
• Current page
• Next and previous pages (if applicable)
The action supports sorting by different methods:
Number Sorting: Sorts numbers in ascending or descending order (e.g., 1, 3, 9 or 25, 12, 9).
Text Sorting: Sorts text based on lexicographical order, considering case differences unless specified (e.g., “Apple”, “Banana”, “Zebra”).
Natural Sorting: Sorts text with numbers in a human-readable way (e.g., “file1”, “file2”, “file10”).
Case-Insensitive Text Sorting: Ignores letter case when sorting text (e.g., “apple”, “Apple”, “Banana”).
Case-Insensitive Natural Sorting: Combines natural sorting with case insensitivity (e.g., “file1”, “File2”, “file10”).
This feature simplifies navigating and managing large datasets.
Utilities
Updated 3 days ago