![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
cerealizer
Advanced tools
Readme
The purpose of this module is to serialize an array of objects (each containing one or more collection objects) into collection arrays of objects with references to relationships.
var cerealizer = require('cerealizer');
var data = [
{
majors: { id: 1, name: 'Capital' },
minors: { id: 'a', height: 33 }
},
{
majors: { id: 1, name: 'Capital' },
minors: { id: 'b', height: 20 }
},
{
majors: { id: 2, name: 'Class' },
minors: { id: 'b', height: 20 }
}
];
console.log(cerealizer(data));
// Outputs
// {
// majors: [
// { id: 1, name: 'Capital', minorIds: ['a', 'b'] },
// { id: 2, name: 'Class', minorIds: ['b'] }
// ],
// minors: [
// { id: 'a', height: 33, majorIds: [1] },
// { id: 'b', height: 20, majorIds: [1, 2] }
// ]
// }
The serializer runs through a series of operations, which are merging of elements, merging of namespaces, building of relationships, and converting to arrays.
This operation changes the data from being a single array of objects each containing one or more collection objects into an array for each collection containing all of their respective elements. The options identifier (default is id
) is used to only add distinct entities to each collection.
This operation merges collections with the same namespace into a single collection. An example of common usage with MySQL is a table containing two different references to a single table, like a user having both a primary and a secondary group. The collections should then be named something like groups:primary
and groups:secondary
, which will cause both of them to be merged into the collection groups
.
This operation builds relationships between entities. The options identifier (default is id
) is used to find the identified relationship. Relationships are found by using singular collection names combined with the identifier (e.g. groupId
for groups
). It also handles many-to-many relationships, where the structure would be a collection called userGroups
with userId
and groupId
, which will create a reference to userId
and groupId
on the corresponding group and user respectively. The userGroups
collection will also be passed along.
This operation runs through all collections and converts the object containing the entities into an array.
Serializes the array of objects into collection arrays of objects with references to relationships.
Example
cerealizer([
{
majors: { id: 1 },
minors: { id: 2 }
}
]);
// Outputs
// {
// majors: [ { id: 1 } ],
// minors: [ { id: 2 } ]
// }
Adds a rule to the Inflectors module that will override existing patterns. Rules added are used for both pluralization and singularization.
Example
cerealizer.inflectors.addRule('foo', 'bar');
cerealizer.inflectors.singularize('foo'); //-> bar
cerealizer.inflectors.pluralize('bar'); //-> foo
Removes a rule from the Inflectors module.
Example
cerealizer.inflectors.addRule('foo', 'bar');
cerealizer.inflectors.singularize('foo'); //-> bar
cerealizer.inflectors.removeRule('foo');
cerealizer.inflectors.pluralize('bar'); //-> bars
================
Mmmm.. Cereal
FAQs
Serializes data and creates relationships
The npm package cerealizer receives a total of 0 weekly downloads. As such, cerealizer popularity was classified as not popular.
We found that cerealizer 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.