UNPKG

@nasriya/atomix

Version:

Composable helper functions for building reliable systems

85 lines (84 loc) 3.13 kB
import arraysUtils from './domains/data-types/array/arrays-utils.js'; import numbersUtils from './domains/data-types/number/numbers-utils.js'; import objectsUtils from './domains/data-types/object/objects-utils.js'; import recordsUtils from './domains/data-types/record/records-utils.js'; import regexUtils from './domains/data-types/regex/regex-utils.js'; import stringsUtils from './domains/data-types/string/strings-utils.js'; import fileSystem from './domains/file-system/file-system.js'; import httpUtils from './domains/http/http-utils.js'; import networks from './domains/network/network-utils.js'; import pathUtils from './domains/path/path.js'; import runtime from './domains/runtime/runtime.js'; import tools from './tools/tools.js'; import commonUtils from './domains/utils/utils.js'; import valueIs from './valueIs.js'; class Atomix { /** * Type guard functions for validating and narrowing values at runtime. * Useful for safely checking primitives, instances, and complex structures. * @since v1.0.0 */ valueIs = valueIs; /** * Utilities for working with core JavaScript data types, organized by type. * Includes helpers for strings, numbers, arrays, objects, records, and regex. * @since v1.0.0 */ dataTypes = objectsUtils.freeze({ string: stringsUtils, number: numbersUtils, object: objectsUtils, record: recordsUtils, array: arraysUtils, regex: regexUtils, }); /** * Path utilities for working with and manipulating file system paths. * Compatible with cross-platform path operations. * @since v1.0.0 */ path = pathUtils; /** * File system utilities for reading, writing, and checking files/directories. * Supports both sync and async operations. * @since v1.0.0 */ fs = fileSystem; /** * HTTP-related utilities for encoding, decoding, and managing request/response bodies. * Includes support for body codecs and common header handling. * @since v1.0.0 */ http = httpUtils; /** * Network utilities for interacting with local/remote addresses, DNS, ports, and tracing. * Useful for diagnostics and runtime-aware networking. * @since v1.0.0 */ networks = networks; /** * Environment utilities for determining runtime characteristics, * such as platform, OS, environment variables, and process metadata. * @since v1.0.0 */ runtime = runtime; /** * General-purpose utility functions and safe wrappers around common JS operations. * Includes cloning, comparison, type-safe conversions, and more. * @since v1.0.0 */ utils = commonUtils; /** * A collection of higher-level tools such as task queues and background managers. * Built for coordination, orchestration, and async workflows. * @since v1.0.2 */ tools = tools; } /** * @runtimeCompatibility * Built and tested on Node.js v22.16.x and later. * Compatibility with earlier Node versions is not guaranteed. */ const atomix = new Atomix; export default atomix;