Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as mod from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/datum.ts";

This file contains the Datum algebraic data type. Datum represents an optional value that has an additional notation for a pending state.

§Variables

ApplicableDatum
bind
bindTo
FilterableDatum
FlatmappableDatum
initial

Create an Initial datum.

MappableDatum
pending

Create a Pending datum.

tap
TraversableDatum
WrappableDatum

§Functions

alt

Provide an alternative Datum if the current one has no value.

apply

Apply a function wrapped in a Datum to a value wrapped in a Datum.

constInitial

Create a constant Initial datum.

constPending

Create a constant Pending datum.

exists

Check if a Datum satisfies a predicate.

filter

Filter a Datum based on a predicate.

filterMap

Filter and map a Datum using an Option.

flatmap

Chain Datum computations together.

fold

Fold over a Datum to produce a single value.

fromNullable

Create a Datum from a nullable value.

getCombinableDatum

Create a Combinable instance for Datum given a Combinable for the inner type.

getComparableDatum

Create a Comparable instance for Datum given a Comparable for the inner type.

getInitializableDatum

Create an Initializable instance for Datum given an Initializable for the inner type.

getOrElse

Get the value from a Datum or return a default.

getShowableDatum

Create a Showable instance for Datum given a Showable for the inner type.

getSortableDatum

Create a Sortable instance for Datum given a Sortable for the inner type.

isInitial

Check if a Datum is in the Initial state.

isLoading

Check if a Datum is loading (Pending or Refresh).

isNone

Check if a Datum has no value (Initial or Pending).

isPending

Check if a Datum is in the Pending state.

isRefresh

Check if a Datum is in the Refresh state.

isReplete

Check if a Datum is in the Replete state.

isSome

Check if a Datum has a value (Refresh or Replete).

map

Apply a function to the value in a Datum.

match

Pattern match on a Datum to extract values.

partition

Partition a Datum based on a predicate.

partitionMap

Partition and map a Datum using an Either.

refresh

Create a Refresh datum with a value.

replete

Create a Replete datum with a value.

toLoading

Convert a Datum to a Loading state.

traverse

Traverse over a Datum using the supplied Applicable.

tryCatch

Create a Datum from a function that might throw.

wrap

Wrap a value in a Replete Datum.

§Interfaces

KindDatum

Specifies Datum as a Higher Kinded Type, with covariant parameter A corresponding to the 0th index of any substitutions.

§Type Aliases

Datum

The Datum type represents an optional value with loading states.

Initial

The Initial state represents a datum that has not been loaded yet.

Loading

The Loading type represents states that are currently loading.

None

The None type represents states without a value.

Pending

The Pending state represents a datum that is currently loading.

Refresh

The Refresh state represents a datum that is refreshing with stale data.

Replete

The Replete state represents a datum that has been fully loaded.

Some

The Some type represents states with a value.