
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
bedazzlejs
Advanced tools
A tiny functional way to decorate objects with composable behaviors.
BedazzleJS lets you progressively add methods and properties to objects using pure functions — no classes, no heavy frameworks.
BedazzleJS is a tiny library (less than 1KB) that helps you compose objects from multiple behaviors without needing class hierarchies, mutation, or complexity.
Instead of rigid blueprints (like classes), you add behaviors one step at a time with small, reusable functions.
class inheritance messnpm install bedazzlejs
or
pnpm add bedazzlejs
import { bedazzle } from 'bedazzlejs';
const withWheels = obj => ({
roll: () => console.log(`Rolling with ${obj.wheels} wheels!`)
});
const withHorn = obj => ({
honk: () => console.log('Beep beep!')
});
const vehicle = bedazzle({ wheels: 4 }, withWheels, withHorn);
vehicle.roll(); // Rolling with 4 wheels!
vehicle.honk(); // Beep beep!
You can easily add more decorators without changing the original object structure.
bedazzle(state, ...fns)| Parameter | Type | Description |
|---|---|---|
state | Object | The base object to decorate |
...fns | Function[] | Functions that receive the object and return partial objects to merge |
Each function gets the current object and can return new properties, methods, or even call next() to continue decorating recursively.
| Classes | Factory Functions | BedazzleJS | |
|---|---|---|---|
| Extendability | Medium (inheritance) | Medium (closures) | High (pure functions) |
| Testability | Medium | High | Very High |
| Complexity | Higher over time | Moderate | Very Low |
BedazzleJS gives you the freedom of factories with the simplicity of pure functions.
MIT © Brad Mehder
Pull requests, issues, and ideas are welcome!
FAQs
Progressively decorate your objects with composable functions.
We found that bedazzlejs 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

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