All files / src/utils index.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

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                                                                        27x 24x 17x  
/**
 * @module
 *
 * Framework utilities — pure helpers this package itself depends on.
 *
 * @remarks
 * These are published because the kernel needs them, not because they aim to be
 * a general-purpose utility belt. `Text` shortens a telemetry sampling key,
 * `Time` stamps every log line and measures every request, and `Signature` signs
 * a value that has to travel somewhere the process does not control. Application
 * code may use them too, through the package barrel.
 *
 * 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 { Signature, Text, Time } from '@bayudwiyansatria/core'
 * ```
 *
 * @author Bayu Dwiyan Satria
 * @version 1.0.0
 * @since 1.0.0
 */
export { Signature } from '@/utils/Signature'
export { Text } from '@/utils/Text'
export { Time } from '@/utils/Time'