DrapCode Utility

raw JSON →
2.6.6 verified Sat Apr 25 auth: no javascript

A utility library for DrapCode containing constants, logging, and general helpers. Current stable version is 2.6.6. The package provides a set of reusable functions and constants aimed at simplifying DrapCode development. It includes TypeScript definitions. It is a lightweight, focused tool for internal DrapCode projects, with no major alternatives mentioned.

error ERR_REQUIRE_ESM: require() of ES Module not supported
cause Attempting to use CommonJS require() on an ESM-only package.
fix
Change to import statement or set type: 'module' in package.json.
error Cannot find module 'drapcode-utility' or its corresponding type declarations.
cause Missing or misconfigured TypeScript module resolution.
fix
Ensure tsconfig.json includes 'drapcode-utility' in types or node_modules.
gotcha ESM only: The package provides only ES modules. Using require() will result in an error.
fix Use import statements instead of require().
gotcha Named exports only: All exports are named; there is no default export.
fix Import using named import syntax, e.g., import { Logger } from 'drapcode-utility'.
npm install drapcode-utility
yarn add drapcode-utility
pnpm add drapcode-utility

Demonstrates importing and using the Logger class from DrapCode Utility.

import { Logger } from 'drapcode-utility';

const logger = new Logger();
logger.info('Hello DrapCode!');