
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.
Codelike is a utility for creating code-like obects in javascript. For example:
import Codelike from codelike;
const codelike = new Codelike('Action', []);
const site = codelike.builder;
const action = site.authenticate('jonathan', 'password1').then(site.popup.close().when(site.authenticated);
This looks like ordinary code but the resulting action object does not actually do anything. The structure of the statement is simply stored away in a format we can use for our own purposes. The 'codelike' object can be used to convert the structure into a string, so:
codelike.stringify(action)
will return a string that looks very like the original statement used to create action. So far, so useless. To really use codelike we need to create a formatter object.
class myOwnStringify {
constructor() { this.out=""; }
visitRoot(name) { this.out += name; }
result() { return this.out; }
visitThen(first, then) {
first.visit(this); this.out+=';' then.visit(this);
}
visitWhen(action, condition) {
this.out+="if("; condition.visit(this); this.out+=")"
this.out+="then"; action.visit(this);
}
visitGet(first, name) {
first.visit(this);
this.out+=`\${name}`;
}
visitCall(accessor, name, parameters) {
accessor.visit(this); this.out+=':';
this.out+=`\${name}(${parameters.join(','))`
}
}
This formatter object will output the code in an entirely different syntax. To use your own formatters, simply do:
const codelike = new Codelike('MyAction', [ myOwnStringify ]);
then codelike.myOwnStringify(action) will return a formatted string (or any other type of object) to your own requirements as formatted by myOwnStringify.
FAQs
Utility for creating codelike objects in javascript
We found that codelike 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.