
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.
Local Asynchronous Module Definition library
lamd is an "offline" AMD implementation, designed to provide require and define methods for a local set of modules. require makes no remote calls, and expects everything to be defined by the corresponding define method.
lamd uses simple wrapper functions, along with setImmediate, to execute dependency factories and callbacks with decent performance (it used to use Promises). No timers or intervals are used, unless setImmediate is not available (make sure to polyfill for best performance!).
lamd was built as a result of experiences while working at Kiosked - Kiosked's front-end script bundles its entire library for delivery to the client, and makes use of AMD to define its modules. Because no modules are requested from remote sources, a clean form of local-style AMD was required.
You can define a module by doing the following:
define("my-module", function() {
return {
myMethod: function() {
return true;
}
};
});
// or, for example:
define("my-module", ["my-dependency"], function(dep) {
return function() {
return dep();
};
});
define's method signature is define(id[, dependencies], callback), where:
id is the ID of the module, which is requireddependencies is an optional string or array or dependent module IDscallback is a required callback function which takes the dependent module outputs as parametersrequire can be viewed as the same as the define method, but without an ID.
require's method signature is require(dependencies[, callback]), where:
dependencies is a string or array of required module outputscallback is a callback function which takes the required dependency outputs as parametersrequire can return the defined module instance if it's ready: simply require only 1 module and do not provide a callback:
var MyModule = require("MyModule");
require will return undefined if the module is not ready. Remember that define works asynchronously.
lamd writes lamd to the global object (or current context), so you can access its methods like so:
lamd.define // Function
lamd.require // Function
lamd.setImmediate // Function
lamd's setImmediate may resolve to setTimeout(fn, 0) if a setImmediate polyfill is not available. I recommend using this one by YuzuJS.
FAQs
Local Asynchronous Module Definition library
We found that lamd 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.