Socket
Socket
Sign inDemoInstall

@solana/functional

Package Overview
Dependencies
Maintainers
14
Versions
1142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/functional - npm Package Compare versions

Comparing version 2.0.0-experimental.e0b865d to 2.0.0-experimental.e6fc977

dist/types/index.d.ts.map

2

dist/index.browser.js

@@ -7,3 +7,1 @@ // src/pipe.ts

export { pipe };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map
{
"name": "@solana/functional",
"version": "2.0.0-experimental.e0b865d",
"version": "2.0.0-experimental.e6fc977",
"description": "Functional JavaScript helpers",

@@ -50,4 +50,4 @@ "exports": {

"@solana/eslint-config-solana": "^1.0.2",
"@swc/jest": "^0.2.28",
"@types/jest": "^29.5.5",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.3.0",

@@ -59,3 +59,3 @@ "@typescript-eslint/parser": "^6.3.0",

"jest": "^29.7.0",
"jest-runner-eslint": "^2.1.0",
"jest-runner-eslint": "^2.1.2",
"jest-runner-prettier": "^1.0.0",

@@ -84,8 +84,8 @@ "prettier": "^2.8",

"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/*",
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
"test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
"test:treeshakability:browser": "agadoo dist/index.browser.js",
"test:treeshakability:native": "agadoo dist/index.node.js",
"test:treeshakability:node": "agadoo dist/index.native.js",
"test:treeshakability:native": "agadoo dist/index.native.js",
"test:treeshakability:node": "agadoo dist/index.node.js",
"test:typecheck": "tsc --noEmit",

@@ -92,0 +92,0 @@ "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",

@@ -24,2 +24,27 @@ [![npm][npm-image]][npm-url]

`pipe`: A functional utility function for piping a value through various functions
### `pipe()`
Until the [pipe operator](https://github.com/tc39/proposal-pipeline-operator) becomes part of JavaScript you can use this utility to create pipelines.
```ts
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.
```ts
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)
);
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc