
Research
Malicious npm Package Brand-Squats TanStack to Exfiltrate Environment Variables
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.
flattenizer
Advanced tools
Functions to flatten and unflatten nested JavaScript objects into a single level.
npm install flattenizer
import { flatten, unflatten } from 'flattenizer';
// Flatten a nested object
const nested = {
name: 'Sean',
city: 'Kansas City',
favBreweries: [
{ name: 'Double Shift', favBeer: 'Sister Abbey' },
{ name: 'KC Bier Co', favBeer: 'Helles' }
]
};
flatten(nested);
// {
// name: 'Sean',
// city: 'Kansas City',
// 'favBreweries.0.name': 'Double Shift',
// 'favBreweries.0.favBeer': 'Sister Abbey',
// 'favBreweries.1.name': 'KC Bier Co',
// 'favBreweries.1.favBeer': 'Helles'
// }
// Unflatten back to nested
const flat = {
name: 'Sean',
city: 'Kansas City',
'favBreweries.0.name': 'Double Shift',
'favBreweries.0.favBeer': 'Sister Abbey',
'favBreweries.1.name': 'KC Bier Co',
'favBreweries.1.favBeer': 'Helles'
};
unflatten(flat);
// {
// name: 'Sean',
// city: 'Kansas City',
// favBreweries: [
// { name: 'Double Shift', favBeer: 'Sister Abbey' },
// { name: 'KC Bier Co', favBeer: 'Helles' }
// ]
// }
flatten<A, B>(unflattened: B | null | undefined, delimiter?: string): A | null | undefinedFlattens a nested object into a single-level object with dot-separated keys.
'.')null/undefined if input is null/undefinedunflatten<A, B>(flattened: A | null | undefined, delimiter?: string): B | null | undefinedUnflattens a flat object with dot-separated keys back into a nested object.
'.')null/undefined if input is null/undefinedNote: Dangerous keys (__proto__, prototype, constructor) are blocked to prevent prototype pollution attacks.
Both functions accept an optional delimiter:
flatten({ a: { b: 1 } }, '|');
// { 'a|b': 1 }
unflatten({ 'a|b': 1 }, '|');
// { a: { b: 1 } }
npm install # Install dependencies
npm test # Run tests
npm run build # Build for production
npm start # Watch mode
MIT
FAQs
Small library for flattening and unflattening objects.
We found that flattenizer demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.