Gathering detailed insights and metrics for option-monad-ts
Gathering detailed insights and metrics for option-monad-ts
Gathering detailed insights and metrics for option-monad-ts
Gathering detailed insights and metrics for option-monad-ts
ts-results
A typescript implementation of Rust's Result and Option objects.
ts-results-es
A TypeScript implementation of Rust's Result and Option objects.
@mobily/ts-belt
🔧 Fast, modern, and practical utility library for FP in TypeScript.
ts-option-monad
``` npm install ts-option-monad ```
npm install option-monad-ts
Typescript
Module System
Node Version
NPM Version
70.3
Supply Chain
85.1
Quality
75.6
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
3,842
Last Day
2
Last Week
29
Last Month
41
Last Year
522
MIT License
1 Stars
14 Commits
2 Watchers
2 Branches
2 Contributors
Updated on Apr 16, 2021
Minified
Minified + Gzipped
Latest Version
0.1.4
Package Id
option-monad-ts@0.1.4
Unpacked Size
12.02 kB
Size
3.82 kB
File Count
6
NPM Version
6.14.6
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
100%
2
Compared to previous day
Last Week
2,800%
29
Compared to previous week
Last Month
272.7%
41
Compared to previous month
Last Year
9.4%
522
Compared to previous year
7
Yet another port of the Scala Option type to TypeScript.
1npm i --save option-monad-ts
1import { Option, Some, None } from 'option-monad-ts'; 2 3// Create Some 4let n = new Some(3); 5let m = Some.of('four'); 6 7// Create Option 8let c = Option.of(3); 9let d = Option.of(null); 10 11// Validate and use 12n.get(); // 3 13m.get(); // 'four' 14 15c.isDefined(); // true 16d.isDefined(); // false 17 18Some.of(4) 19 .map(_ => _.toString()) 20 .forEach(_ => console.log(_))
Option<T>
of<T>(x: T): Option<T>
An Option factory which creates Some.of(x) if the argument is not null, and None if it is null.
filter(p: (i: T) => boolean): Option<T>
Returns this Option if it is nonempty and applying the predicate p to this Option's value returns true. Otherwise, return None.
flatMap<R>(f: (i: T) => Option<R>): Option<R>
Returns the result of applying f to this Option's value if this Option is nonempty. Returns None if this Option is empty. Slightly different from map in that f is expected to return an Option (which could be None).
forEach<U>(f: (i: T) => U): void
Apply the given procedure f to the option's value, if it is nonempty. Otherwise, do nothing.
get(): T
Returns the option's value. The option must be nonEmpty.
getOrElse(defaultValue: T): T
Returns the option's value if the option is nonempty, otherwise return defaultValue.
isDefined(): boolean
Returns true if the option is an instance of Some, false otherwise.
isEmpty(): boolean
Returns true if the option is None, false otherwise.
map<R>(f: (i: T) => R): Option<R>
Returns a Some containing the result of applying f to this Option's value if this Option is nonempty. Otherwise, return None.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-09
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