Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@solana/functional
Advanced tools
This package contains generalized functional helpers and functional helpers
specific to Solana application components. It can be used standalone, but it
is also exported as part of the Solana JavaScript SDK
@solana/web3.js@experimental
.
pipe()
Until the pipe operator becomes part of JavaScript you can use this utility to create pipelines.
const add = (a, b) => a + b;
const add10 = x => add(x, 10);
const add100 = x => add(x, 100);
const sum = pipe(1, add10, add100);
sum === 111; // true
A pipeline is one solution to performing consecutive operations on a value using functions, such as you would when building a transaction.
const transferTransaction = pipe(
// The result of the first expression...
createTransaction({ version: 0 }),
// ...gets passed as the sole argument to the next function in the pipeline.
tx => setTransactionFeePayer(myAddress, tx),
// The return value of that function gets passed to the next...
tx => setTransactionLifetimeUsingBlockhash(latestBlockhash, tx),
// ...and so on.
tx => appendTransactionInstruction(createTransferInstruction(myAddress, toAddress, amountInLamports), tx)
);
FAQs
Functional JavaScript helpers
The npm package @solana/functional receives a total of 7,335 weekly downloads. As such, @solana/functional popularity was classified as popular.
We found that @solana/functional demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 14 open source maintainers 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.