
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
active-serializer
Advanced tools
Rails active_model_serializer inspired nodejs object serializer
npm install active-serializer --save
const serialize = require('active-serializer');
const object = {
id: 'some_id',
name: 'some_name',
unwanted: 'will not be shown',
image_url: async (options) => { return await 'some_url' }
};
const attributes = ['id', 'name', 'image_url'];
const options = {}
const result = await serialize(object, attributes, options);
console.log(result);
Output should be:
{
id: 'some_id',
name: 'some_name',
image_url: 'some_url'
}
const nestedObject = {
id: 'some_id',
name: 'some_name',
unwanted: 'will not be shown',
image_url: async (options) => { return await 'some_url' },
object2: {
id: 'some_other_id',
attr1: 'some_attr',
attr2: 'will not be shown'
}
};
const object2Serializer = async (object2, options) => {
const attributes2 = ['id', 'attr1'];
return await serialize(object2, attributes2, options);
};
const attributes1 = ['id', 'name', 'image_url', 'object2'];
const options = {
'serializers': { 'object2': object2Serializer }
}
const result = await serialize(nestedObject, attributes1, options);
console.log(result);
Output should be:
{
id: 'some_id',
name: 'some_name',
image_url: 'some_url',
object2: {
id: 'some_other_id',
attr1: 'some_attr'
}
}
npm test
Please feel free and report issues or create pull request :]
FAQs
Rails active_model_serializer inspired nodejs object serializer
We found that active-serializer 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.