fpEs

July 1, 2026 · View on GitHub

Complete export surface of fpes v1.2.0, generated from source introspection and verified by executing each module. Companion to OVERVIEW.md.

Stability legend:

  • supported — shown in the README.
  • leaked — exported, tested, and working, but README-silent (the author's own term; see commit 7a4afce "Add some leaked common functions"). Safe to use.
  • internal — implementation detail; do not depend on it.

How to read this doc

require('fpes') returns a flat namespace: Maybe, MonadIO, Publisher, plus every fp and pattern export spread to the top level. Subpath imports (fpes/maybe, fpes/fp, fpes/pattern, fpes/monadio, fpes/publisher) return that single module.

Curried functions accept arguments one group at a time; most also work fully applied.


Maybe (fpes/maybe)

Maybe is a singleton instance of an internal MaybeDef class. None is the shared empty value. Some is any present value. Fantasy Land aliases live on the prototype (Maybe only).

Static / constructor

SymbolKindStabilitySummary
of(ref) / just(ref)fnsupportedWrap a value; null/undefinedNone.
fromFalsy(ref)fnleakedFalsy (0,'',false,null) → None, else Some.
fromPredicate(pred, val)fnleakedSome(val) if pred(val), else None; curries on 1 arg.
empty() / zero()fnleakedReturn None (Fantasy Land monoid/plus identity).

Instance methods

SymbolKindStabilitySummary
isPresent() / isNull()fnsupportedPresence test.
unwrap() / extract()fnsupported / leakedGet the raw value (Nonenull).
map(fn) / then(fn)fnsupportedTransform the value (None short-circuits).
flatMap(fn) / chain(fn) / bind(fn)fnsupported / leakedMonadic bind; fn returns a Maybe.
or(ref) / alt(m)fnsupported / leakedFallback value on None only (no-op on Some).
orDo(fn)fnsupportedLazy fallback on None (runs fn()).
letDo(fn) / extend(fn)fnsupported / leakedMap on Some (no-op on None).
filter(pred)fnleakedKeep value if pred holds, else None.
reduce(reducer, init)fnleakedreducer(init, value); Noneinit.
join()fnleakedFlatten a nested Maybe.
ap(maybeFn)fnleakedApplicative — FL order: value.ap(Maybe.of(fn)).
chainRec(f, i)fnleakedStack-safe recursive chain (trampolined).
equals(m)fnleakedValue equality (SameValueZero; NaN equals NaN).
toList()fnleaked[value] for Some, [] for None.
toString()fnleakedSome(<json>) or None.
fantasy-land/*fnleakedFantasy Land aliases: of,empty,zero,map,ap,chain,join,alt,extend,extract,equals,reduce,filter.
reffieldinternalThe wrapped value. Do not read directly.

MonadIO (fpes/monadio)

A lazy IO monad. Effects are stored and only run on subscribe.

Static

SymbolKindStabilitySummary
of(ref) / just(ref)fnsupportedWrap a value as a pure effect.
doM(genFn)fnsupportedDo-notation: run a generator, awaiting yielded Promise/MonadIO/Maybe. Returns a Promise.
promiseof(ref)fnsupportedPromise.resolve(ref).
fromPromise(p)fnleakedLift a Promise into a MonadIO.
generatorToPromise(genFn)fnleakedLike doM but always returns a Promise.
wrapGenerator(genFn)fninternalStep engine behind doM.

Instance methods

SymbolKindStabilitySummary
map(fn) / then(fn)fnsupportedTransform the eventual value (lazy).
flatMap(fn) / chain(fn)fnsupported / leakedBind; fn returns a MonadIO.
bind(fn)fnleakedAlias of then.
ap(monadFn)fnleakedApplicative apply.
subscribe(fn, async?)fnsupportedRuns the effect; async === true schedules via Promise.
effectfieldinternalThe stored thunk. Do not read directly.

Publisher (fpes/publisher)

A minimal PubSub / observable event bus.

SymbolKindStabilitySummary
new Publisher()ctorsupportedCreate a bus.
subscribe(fn)fnsupportedRegister a handler (deduped); returns fn.
unsubscribe(fn)fnsupportedRemove a handler.
publish(value, async?)fnsupportedEmit to all handlers; async === true schedules via Promise.
map(fn)fnsupportedReturn a derived Publisher of mapped values.
clear()fnleakedRemove all handlers.
subscribers / originfieldinternalHandler list / upstream link. Do not depend on.

fp (fpes/fp)

Ramda/Lodash-style utilities. All 59 are public API; only compose, curry, map appear in the README — the other 56 are "leaked" (working, tested, undocumented).

Function & composition

SymbolCurriedStabilitySummary
compose(...fns)supportedRight-to-left composition.
pipe(...fns)leakedLeft-to-right composition.
curry(fn)supportedCurry by arity (rest params count as 0).
partial(fn, ...pre)yesleakedBind leading args.
partialRight(fn, ...pre)yesleakedBind trailing args.
partialProps(fn, preObj, lateObj)yesleakedMerge preset + later prop objects.
unary(fn, arg)yesleakedCall fn with a single arg.
spread(fn, args)yesleakedApply an array as args.
gather(fn, ...args)yesleakedCollect args into one array param.
not(fn, ...args)yes*leaked!fn(...args) — *fires immediately for not(fn) (see gotchas).
ifelse(test, elseF, fn)yesleakedBranch on test().
when(test, fn)yesleakedfn() if test() else undefined.
trampoline(fn)leakedStack-safe recursion (loop while result is a fn).
memoize(fn)leakedCache results by args (see gotchas re: key collisions).
debounce(fn, ms)yesleaked{ ref, cancel } around setTimeout.
schedule(fn, ms)yesleaked{ ref, cancel } around setInterval.
snooze(ms)leakedPromise that resolves after ms.

Collection & iteration

SymbolCurriedStabilitySummary
map(fn, list)yessupportedMap.
filter(fn, list)yesleakedFilter.
reduce(fn, init, ...list)yesleakedLeft fold (variadic list).
foldl(fn, init, list)yesleakedLeft fold.
foldr(fn, init, list)yesleakedRight fold.
flatten(list)leakedOne-level flatten.
flattenMap(fn, list)yesleakedMap then flatten.
range(n)leaked[0..n-1].
chunk(list, size)yesleakedSplit into size-n chunks.
take(n, list)yesleakedFirst n (immutable).
drop(list, n, dir?, fn?)manualleakedDrop n from left/right, optional filter.
head(list)leakedFirst element ([] if empty).
tail(list)leakedAll but first.
initial(list)leakedAll but last.
shift(list)leakedFirst element (non-mutating).
nth(list, i)manualleakedIndex; negative is mirror-flipped (see gotchas).
reverse(list)leakedReverse array or string.
unique(list)leakedDedupe (first-seen order).
sortedUniq(list)leakedDedupe + sort (numeric-aware).
sortedIndex(list, val, pos?)manualleakedInsertion index for a value.
contains(list, val)leakedMembership test.
find(fn, list)yesleakedFirst match.
findLast(fn, list)yesleakedLast match.
findIndex(fn, list)yesleakedIndex of first match (-1 if none).
findLastIndex(fn, list)yesleakedIndex of last match (-1 if none).
fill(list, val, start?, end?)manualleakedFill range with a value (immutable).
compact(list, typ?)manualleakedDrop falsy (or keep by typeof typ).
pull(list, ...vals)manualleakedRemove given values.

Set operations & zips

SymbolCurriedStabilitySummary
concat(list, ...arrays)leakedConcatenate arrays.
union(a, b, dup?)manualleakedUnion, optional duplicates.
intersection(...arrays)leakedCommon values (main-ordered).
difference(...arrays)leakedIn follower, not in main (deduped).
differenceWithDup(...arrays)leakedDifference keeping duplicates.
zip(...lists)leakedZip parallel arrays.
unzip(list)leakedInverse of zip.
fromPairs(list)leaked[[k,v]] → object.

Object / lens-ish

SymbolCurriedStabilitySummary
prop(key, obj)yesleakedRead a property.
propEq(val, key, obj)yesleakedobj[key] === val.
get(obj, key)yesleakedProperty read (obj-first).
matches(rule, obj)yesleakedShallow object match.
clone(obj)leakedJSON deep clone (undefined/NaN pass through).

pattern (fpes/pattern)

Pattern matching and algebraic data types. 39 exports; 17 shown in README.

Matching entry points

SymbolKindStabilitySummary
either(value, ...patterns)fnsupportedMatch value; runs first matching pattern's effect. Throws if none match and no otherwise.
otherwise(effect)fnsupportedCatch-all pattern.
PatternMatchingclasssupported*Reusable matcher (name shown, usage sparse).
PatternclassinternalRaw (matches, effect) pair; prefer inCaseOf*.
MatchableclassinternalBase class for types.

inCaseOf* guards

SymbolStabilityMatches
inCaseOfEqual(val, effect)supportedstrict ===
inCaseOfClass(cls, effect)supportedinstanceof cls
inCaseOfObject(effect)supportedplain object (not array/null)
inCaseOfNumber(effect)leakednumber (rejects boolean/array; accepts numeric strings)
inCaseOfString(effect)leakedtypeof === 'string'
inCaseOfNaN(effect)leakedNaN/non-number
inCaseOfArray(effect)leakedArray.isArray
inCaseOfNull(effect)leakednull/undefined
inCaseOfFunction(effect)leakedinstanceof Function
inCaseOfRegex(regex, effect)leakedregex test (restores lastIndex for /g,/y)
inCaseOfPattern(effect)leakedvalue is a Pattern
inCaseOfPatternMatching(effect)leakedvalue is a PatternMatching
inCaseOfCompType(effect)leakedvalue is a CompType
inCaseOfCompTypeMatchesWithSpread(ct, effect)leakedarray-spread or direct comp-type match

Type* predicates (matcher objects)

Type* are the ()=>true forms of the guards, usable in ADT/comp-type composition.

SymbolStabilitySummary
TypeNumber TypeString TypeNaN TypeObject TypeArray TypeNullsupportedPrimitive matchers.
TypeEqualTo(val) TypeClassOf(cls) TypeRegexMatches(rx)supportedParameterized matchers.
TypeFunction TypePattern TypePatternMatching TypeCompTypeleakedStructural matchers.
TypeInCaseOf(matches)leakedCustom predicate matcher.
TypeMatchesAllPatterns(...patterns)leakedConjunction (all must match).
TypeCompTypeMatchesWithSpread(ct)leakedSpread-aware comp-type matcher.
TypeADT(adtDef)leakedMatch an object against a {key: Type} schema.

Algebraic data types

SymbolKindStabilitySummary
SumType(...types)classsupportedTagged union — matches if any member matches.
ProductType(...types)classsupportedRecord/tuple — matches if all members match (positional).
CompTypeclasssupportedBase composite type (apply/matches).

Appendix: leaked / alias / Fantasy Land coverage

  • fp: 56 of 59 exports are undocumented in the README (all public, all tested).
  • Maybe: ~30 undocumented instance/static members, including 13 fantasy-land/* aliases and the short aliases chain/bind/alt/extend/extract.
  • pattern: 22 of 39 exports undocumented.
  • MonadIO: fromPromise, generatorToPromise undocumented; wrapGenerator is internal.
  • Publisher: clear undocumented.

Do not depend on (internal): Maybe.ref, MonadIO.effect, MonadIO.wrapGenerator, Publisher.subscribers, Publisher.origin, and the raw Pattern/Matchable classes.

Last verified: v1.2.0 (source introspection + runtime execution).