
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Function to match against stuff.
Inspired by:
Load the thing:
const match = require('pamach');
Pass some args and spec obj:
const drink = 'coke';
const myDrink = match(drink)({
coke: () => { return 'Pssshhh...'; },
wine: () => { return 'I like this harvest from summer 1901...'; },
beer: () => { return 'After a long day...' },
default: () => { return 'H20'; },
});
console.log(myDrink); // -> 'Pssshhh...'
Multiple arguments:
const firstComponent = 'coke';
const secondComponent = 'vodka';
const cocktail = match(firstComponent, secondComponent)({
'coke, vodka': () => { return 'Much better together'; },
'beer, vodka': () => { return 'Are you sure this is a good idea?'; },
default: () => { return 'H20'; }
});
console.log(cocktail); // -> 'Much better together'
Accepts anything that implements .toString
:
const person = {
firstName: 'Steve',
lastName: 'Jobs',
toString: function() { return `${this.firstName} ${this.lastName}` }
};
const collegue = match(person)({
'Steve Jobs': () => {
return { firstName: 'Jonny', lastName: 'Ive' }
},
'Fox Malder': () => {
return { firstName: 'Dana', lastName: 'Scully' }
}
});
console.log(collegue); // -> { firstName: 'Jonny', lastName: 'Ive' }
match([args])
-> FunctionTakes any number of args and returns new matcher
function
matcher(spec)
-> Anythat takes spec
object to map args
separated by ', '
(coma + space) as
key to corresponding function, so value returned by this function becomes the
return value of matcher
.
If no key found for given set of args
, matcher
tries to find default key in
the spec
object and call its value.
If no default
key found, undefined
is returned.
License - MIT
FAQs
Pattern matching utility.
We found that pamach 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.