
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.
blueprint-js
Advanced tools
// Import blueprint
import Blueprint from 'blueprint';
const type = Blueprint.type;
// Create a new class that extends a Blueprint class
// instead of type(t), you can pass in your own function that typecasts a value
const personAttrs = {
id: type('number'),
name: type('string'),
color: type('string')
};
class Person extends Blueprint.build(personAttrs) {}
// Instantiate a new model
let kash = new Person({ id: 1, name: "Kash", color: "red" });
let sanjna = new Person({ id: 2, name: "Sanjna", color: "red" });
function logger() {
console.log(...arguments);
}
// Models inherit from EventEmitter, so you can listen to events.
// By default, there are 2 events: `changed` and `changed:{attr}`,
// where {attr} is the attribute that is updated.
kash.on('changed', logger);
sanjna.on('changed:name', logger);
// Setting values in any way will automatically typecast them
// according to the types provided when you built the blueprint
// You can batch-update attributes with an object passed to `instance.update`
// This will notify 'changed:{attr}' listeners,
// and 'changed' listeners _once_ after all properties have been updated.
kash.update({ color: "navy" });
// the above will notify logger
// Or you can use regular JavaScript getters and setters
// (or the `instance.get` and `instance.set` methods).
// These will notify the 'changed:{attr}' and the 'changed' listeners.
sanjna.color = "yellow"; // or sanjna.set("color", "yellow");
// the above will not notify logger because logger is
// only listening to 'changed:name' events
// The `instance.toObject()` method will return the instance's attributes object
sanjna.toObject(); // returns { id: 2, name: "Sanjna", color: "yellow" }
// The `instance.toString()` is an alias for `instance.toObject().toJSON()`
kash.toString();
FAQs
Full-featured JavaScript class creator. Simple, convenient API.
We found that blueprint-js 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
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.