All files / src/utils index.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 5/5
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                                                                              20x 23x 31x 28x 21x  
/**
 * @module
 *
 * Framework utilities — pure helpers this package itself depends on.
 *
 * @remarks
 * These are narrow on purpose: this is not a general-purpose utility belt. `Text`
 * shortens a telemetry sampling key and `Time` stamps every log line, both for the
 * kernel itself; `Signature` signs a value that has to travel somewhere the process
 * does not control, `List` partitions a batch against a ceiling the caller knows,
 * and `Json` reads a body the caller did not write. The last three the kernel does
 * not call — they are here because a helper that is pure, vendor-neutral and
 * already written twice in two consumers is a helper those consumers should share
 * rather than keep diverging copies of.
 *
 * An application's *own* helpers — the ones encoding decisions about its input
 * and its domain — belong in that application, not here. The one-way rule is the
 * point: this package never imports from a consumer.
 *
 * Everything here is a pure function over its arguments: no environment, no
 * binding, no configuration. A helper that needs any of those is a capability,
 * and belongs behind an interface in
 * [`types/capabilities/`](../types/capabilities/index.ts) with an adapter to
 * implement it.
 *
 * A helper that exists *because the obvious alternative is unsafe* belongs in
 * [`security/`](../security/index.ts) instead. `Signature` stays here because it
 * is a pure function like the other two; `timingSafeEqual` is over there because
 * making a comparison safe is its only reason to exist.
 *
 * @example
 * ```ts
 * import { Json, List, Signature, Text, Time } from '@bayudwiyansatria/core'
 * ```
 *
 * @author Bayu Dwiyan Satria
 * @version 1.0.0
 * @since 1.0.0
 */
export { Json } from '@/utils/Json'
export { List } from '@/utils/List'
export { Signature } from '@/utils/Signature'
export { Text } from '@/utils/Text'
export { Time } from '@/utils/Time'