
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.
Metaknight is a little library for meta-trickery with javascript functions. It uses esprima and escodegen to take your existing javascript functions, tear them apart and rebuild them, better and stronger than before*
* use only as directed, functions may not be better or stronger, does not work on arrow functions or functions expecting closure context, this is probably not a very useful library
Let's get started
> var meta = require('metaknight')
Have you ever wished a function's arguments were in a different order?
> function minus(a, b) { return b - a; }
> minus(1, 3)
2
> var betterminus = meta(minus).reorder([1,0])()
> betterminus(1, 3)
-2
> betterminus.toString() //toString output cleaned up slightly
'function anonymous(b,a) {return b - a;}'
Or that some arguments were optional?
> function add(a, b) { return a + b; }
> add(5, 7)
12
> var add5 = meta(add).assign({b: 1})()
> add5(10)
15
> add5.toString()
'function anonymous(b) {return 5 + b;}'
Or you could partially apply a function like a functional programmer?
> var add4 = meta(add).curry(4)()
> var add4 = meta(add)(4) // this is a shortcut
> add4(10)
14
> add4.toString()
'function anonymous(b) {return 5 + b;}'
Or that you could rename arguments?
> var funadd = meta(add).rename({a: "hello", b: "world"})()
> funadd(1, 2)
-2
> add5.toString()
'function anonymous(hello,world) {return hello + world;}'
Or even take two totally separate functions and smoosh them together?
> function hello() { console.log("hello"); }
> function world() { console.log("world"); }
> var helloworld = meta(hello).concat(meta(world))()
> helloworld()
hello
world
> helloworld.toString()
'function anonymous(\n) {console.log(\'hello\'); console.log(\'world\')}'
Well, whether you wished for these things or not, now you have them!
FAQs
Meta-trickery with parsers!
The npm package metaknight receives a total of 0 weekly downloads. As such, metaknight popularity was classified as not popular.
We found that metaknight 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.