
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Immutable, inheritable objects with information hiding.
The snowman() function creates factory functions for objects with the
following features:
Object.getPrototypeOfObject.freezeThese features allow data to be shared in an exclusive manner, without exposing
it for modification or even readability. Implementation details no longer leak,
sparing projects from additional maintenance and documentation. Data is more
secure, if not completely locked-away, from malicious 3rd-parties. No more
object._pinkyPromise.
Let it snow, let it snow, let it snow... ❄
Browser:
bower install snowman
<script src="bower_components/snowman/snowman.js"></script>
Node:
npm install snowman
Via browser global:
(function (snowman) {
var factory = snowman({});
}(window.snowman));
AMD:
require(['snowman'], function (snowman) {
var factory = snowman({});
});
CommonJS:
var snowman = require('snowman'),
factory = snowman({});
(function () {
'use strict';
var personFactory = snowman({
static: {
protected: {
isBirthday: function () {
var today = new Date();
return today.getMonth() === this.birthday.getMonth() &&
today.getDate() === this.birthday.getDate();
}
},
public: {
consultOnAge: function () {
console.log('I\'m ' + this.age + '.');
},
consultOnBirthday: function () {
if (this.isBirthday()) {
console.log('It\'s my birthday! How did you guess?');
} else {
console.log('It\'s my un-birthday.');
}
},
salutation: function () {
console.log('The name\'s ' + this.name + '.');
}
}
},
local: {
private: ['birthday'],
protected: ['age'],
public: ['name']
},
constructor: function (spec) {
this.birthday = spec.birthday;
this.age = spec.age;
this.name = spec.name;
}
}),
potentiallyMoreExperiencedFactory = snowman({
extends: personFactory,
static: {
public: {
consultOnAge: function () {
var parent = Object.getPrototypeOf(this);
if (this.age >= 45) {
console.log('None of your business.');
} else {
parent.consultOnAge();
}
}
}
}
}),
joe = personFactory({
name: 'Joe',
age: 25,
birthday: new Date()
}),
sam = potentiallyMoreExperiencedFactory({
name: 'Sam',
age: 45,
birthday: new Date(Date.now() - 1000 * 60 * 60 * 24)
}),
bobby = potentiallyMoreExperiencedFactory({
age: 44
});
console.log(joe.name); // "Joe"
console.log(joe.age); // undefined
console.log(joe.birthday); // undefined
joe.salutation(); // The name's Joe.
joe.consultOnBirthday(); // It's my birthday! How did you guess?
joe.consultOnAge(); // I'm 25.
console.log(sam.name); // "Sam"
console.log(sam.age); // undefined
console.log(sam.birthday); // undefined
sam.salutation(); // The name's Sam.
sam.consultOnBirthday(); // It's my un-birthday.
sam.consultOnAge(); // None of your business.
bobby.consultOnAge(); // I'm 44.
}());
For more examples, see tests/.
# Watch for changes and run tests.
grunt watch
# Lint, test, build.
grunt
FAQs
Immutable, inheritable objects with information hiding.
We found that snowman 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.