
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.
Library provides an API for creating sets of namespaced properties for any given objects (frozen or not). This effectively may be used for creating fields that are not part of object's public API, which is useful for hiding internal details or for adding fields to an existing objects (Built-ins or not) without mutating them and there for any risks of naming conflicts.
It is recommended to use this library with enabled WeakMaps. On node that
simply means running it with additional flag: node --harmony_weakmaps. If
weak maps are not available library will fallback to using imperfect weak map
shim.
var ns = require('namespace/core').ns
var internals = ns()
internals(publicAPI).secret = secret
Namespace may be used with multiple objects:
var observable = ns()
function Observable() {
observable(this).observers = []
}
Observable.prototype.observe = function(observer) {
observable(this).observers.push(observer)
}
Also, multiple namespaces can be used with a same object without any conflicts.
var pending = ns()
function Eventual() {
Observable.call(this)
pending(this).realized = false
}
Eventual.prototype = Object.create(Observable.prototype)
Eventual.prototype.realize = function realize(value) {
if (!pending(this).realized) {
obesrvable(this).observers.splice.forEach(function(observer) {
observer(value)
})
}
}
Access to the namespaced properties can be shared with other code by simple
handing a namespace function. Although doing this across modules is not
recommended, for example instead of sharing pending namespace one could share
following function instead:
exports.isRealized = function isRealized(value) {
return pending(value).realized
}
Namespaced objects create parallel inheritance chain, or more simply:
var foo = ns()
var ancestor = {}
foo(ancestor) === foo(Object.create(ancestor)) // => true
Namespaces are simply a sugar on top of ES.next WeakMaps allowing you to associate sets of namespaced properties to an object via weak references.
npm install namespace
FAQs
Library for defining namespaced properties.
We found that namespace 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.