Gathering detailed insights and metrics for @morphism/runtime
Gathering detailed insights and metrics for @morphism/runtime
Gathering detailed insights and metrics for @morphism/runtime
Gathering detailed insights and metrics for @morphism/runtime
npm install @morphism/runtime
Typescript
Module System
Node Version
NPM Version
TypeScript (94.92%)
JavaScript (5.08%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
88 Commits
21 Branches
2 Contributors
Updated on Apr 28, 2022
Latest Version
0.1.9
Package Id
@morphism/runtime@0.1.9
Unpacked Size
13.84 kB
Size
4.42 kB
File Count
9
NPM Version
lerna/3.22.1/node@v14.17.6+arm64 (darwin)
Node Version
14.17.6
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A combination of io-ts and io-ts-types, exported under
a namespace called Runtime
, that acts as an all-in-one input/output
validation library.
If we have an endpoint that accepts a payload of the following shape:
1{ 2 username: string; 3 hoursWorked: string; 4 isOvertime?: string; 5 date: number 6}
and, after parsing/validation, needs to be transformed to:
1{ 2 username: string; 3 hoursWorked: number; 4 isOvertime: boolean; 5 date: Date 6}
where
username
is a required parameter that we want a special error message forisOvertime
is an optional argument we want to fill with a default value when
it isn't provideddate
is a UNIX epoch representing a Date
hoursWorked
is just some numberThen we could use @morphism/runtime
to describe the above logic like so:
1import { Runtime } from "@morphism/runtime"; 2 3type Request = Runtime.ToType<typeof runtime>; 4namespace Request { 5 export const runtime = () => 6 Runtime.strict({ 7 username: Runtime.withMessage( 8 Runtime.string(), 9 () => 'Some special error message for just username' 10 ), 11 hoursWorked: Runtime.numberFromString(), 12 isOvertime: Runtime.withFallback(Runtime.booleanFromString(), false), 13 dateRange: Runtime.dateFromUnixTime(), 14 }); 15}
Request
now represents the shape our Request.runtime
function validates,
and can be used like so:
1pipe( 2 input, 3 Request.runtime().decode, 4 Either.fold( 5 (errors: Runtime.Errors) => ..., 6 (request: Request) => ... 7 ) 8)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
51 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More