
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.
micro-namespace
Advanced tools
Wrap libraries into a namespace.
$ hg clone https://bitbucket.org/frostbane/micro-namespace
$ npm install micro-namespace
var ns = require("micro-namespace");
<script type="text/javascript"
src="micro-namespace.js"></script>
simple namespace
// create fb.common.util namespace
namespace("fb.common.util");
// add methods to fb.common.util
fb.common.util.formatDate = function(...){ ... };
fb.common.util.logError = function(...){ ... };
// use the methods/classes
if(!fb.common.util.formatDate("2017/12/14")){
fb.common.util.logError("format failed");
}
namespace and object
// create fb.common.extra namespace with methods
namespace("fb.common.extra", {
getDateNow :function(){ ... },
getServerUrl :function(){ ... },
AjaxParser :function(){ ... },
});
// use the methods/classes
var now = fb.common.extra.getDateNow();
var host = fb.common.extra.getServerUrl();
var ax = new fb.common.extra.AjaxParser();
amd require
var ns = require("micro-namespace");
ns("fb.ajax", {
getUsername :function(){ ... },
});
var user = fb.ajax.getUsername();
initialize object
the third parameter (init) is called under the context of the second parameter (obj) after the namespace is created.
namespace("fb.common.upload", {
uploadFile :function(){},
initUploader :function(){},
resetErrors :function(){},
}, function(){
// exported methods can be accessed with this
this.initUploader();
this.resetErrors();
$(function(){
$("#cal").datepicker();
});
});
FAQs
Wrap object into a namespace
The npm package micro-namespace receives a total of 3 weekly downloads. As such, micro-namespace popularity was classified as not popular.
We found that micro-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
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.