@hazae41/option
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -1,3 +0,3 @@ | ||
export { None, NoneError } from './mods/option/none.js'; | ||
export { Option, Optional } from './mods/option/option.js'; | ||
export { Some } from './mods/option/some.js'; | ||
export { None, NoneError, NoneInit } from './mods/option/none.js'; | ||
export { NonOptional, Option, OptionInit, Optional } from './mods/option/option.js'; | ||
export { Some, SomeInit } from './mods/option/some.js'; |
@@ -8,2 +8,4 @@ import { Err } from '@hazae41/result'; | ||
} | ||
interface NoneInit { | ||
} | ||
declare class None { | ||
@@ -20,2 +22,3 @@ readonly inner: undefined; | ||
static new(): None; | ||
static from(init: NoneInit): None; | ||
/** | ||
@@ -232,2 +235,2 @@ * Type guard for `Some` | ||
export { None, NoneError }; | ||
export { None, NoneError, NoneInit }; |
import { Promiseable } from '../../libs/promises/promises.js'; | ||
import { None } from './none.js'; | ||
import { Some } from './some.js'; | ||
import { NoneInit, None } from './none.js'; | ||
import { SomeInit, Some } from './some.js'; | ||
type Optional<T> = T | undefined; | ||
type NonOptional<T> = T & ({} | null); | ||
type OptionInit<T> = SomeInit<T> | NoneInit; | ||
type Option<T> = Some<T> | None; | ||
declare namespace Option { | ||
function from<T>(init: OptionInit<T>): Option<T>; | ||
/** | ||
@@ -13,3 +16,3 @@ * Create an Option from a maybe undefined value | ||
*/ | ||
function from<T>(inner: Optional<T>): Option<T>; | ||
function wrap<T>(inner: Optional<T>): Option<NonOptional<T>>; | ||
function map<T, U>(inner: Optional<T>, mapper: (inner: T) => Promiseable<U>): Promise<U | undefined>; | ||
@@ -19,2 +22,2 @@ function mapSync<T, U>(inner: Optional<T>, mapper: (inner: T) => U): U | undefined; | ||
export { Option, Optional }; | ||
export { NonOptional, Option, OptionInit, Optional }; |
@@ -5,2 +5,5 @@ import { Ok } from '@hazae41/result'; | ||
interface SomeInit<T> { | ||
inner: T; | ||
} | ||
declare class Some<T> { | ||
@@ -19,2 +22,3 @@ readonly inner: T; | ||
static new<T>(inner: T): Some<T>; | ||
static from<T>(init: SomeInit<T>): Some<T>; | ||
/** | ||
@@ -231,2 +235,2 @@ * Type guard for `Some` | ||
export { Some }; | ||
export { Some, SomeInit }; |
{ | ||
"type": "module", | ||
"name": "@hazae41/option", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Rust-like Option for TypeScript", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/option", |
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123362
1817