Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / helpers

helpers

Named helper exports — importable, tree-shakeable, never globals. Import from @zerotal/core/helpers.

A grab-bag of small, dependency-free utilities used throughout an application: path resolution (basePath), environment-variable access (env, requireEnv, setAppEnv), value-flow combinators (tap, tapAsync, pipe, pipeAsync), error suppression (rescue, rescueSync), safe nested lookups (data_get), the Str string helper, and markdownPage for rendering standalone Markdown documents.

Example

import { env, requireEnv, tap, data_get } from '@zerotal/core/helpers';

const debug   = env('APP_DEBUG', false);          // boolean, coerced
const appKey  = requireEnv('APP_KEY');            // throws if unset
const city    = data_get(payload, 'user.address.city', 'Unknown');
const user    = tap(await User.create(data), (u) => log(`created ${u.id}`));

@packageDocumentation

Interfaces

Functions

References

Str

Re-exports Str


pluralize

Re-exports pluralize


singularize

Re-exports singularize


tableNameFor

Re-exports tableNameFor


deepMerge

Re-exports deepMerge


parseCookieHeader

Re-exports parseCookieHeader