
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
@ollopa/trust
Advanced tools
Utility library to add Rust idioms into
npm install @ollopa/trust
yarn add @ollopa/trust
Add "experimentalDecorators": true,
to your tsconfig.json
file.
The purpose of this library is to give Typescript ergonomic Rust idioms.
Please open a RFC issue if an API can be improved in any way.
Very open for suggestions on a better API for this.
WIP. Needs range
, default
, etc.
const token: { type: 'semi' | 'identifier' | 'unknown', value: string } = getToken()
const result = match(token.type,
// match arms
['semi', handleSemi(token)],
['identifier', handleIdentifier(token)],
['unknown', handleUnknown(token)],
)
match
returns an Option
because of limitations with typing. For example...
match('some string',
['yeet', 'yoot']
)
...will never match to anything and therefore will return an Option.None
.
Utility type to create a sum type.
type ASTNode =
Var<'int' | 'string' | 'infix', { token: string }> // the `token` data is common across all nodes
& ( // Enum variants
Var<'int', { value: number }> |
Var<'string', { value: string }> |
Var<'infix', { operator: '+' | '-', left: ASTNode, right: ASTNode }>
)
FAQs
Rust idioms in Typescript
The npm package @ollopa/trust receives a total of 1,342 weekly downloads. As such, @ollopa/trust popularity was classified as popular.
We found that @ollopa/trust 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.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.