{"id":12971,"library":"codsen-utils","title":"Codsen Utilities","description":"codsen-utils is a JavaScript utility library offering a collection of various helper functions designed for common development tasks. It is currently at version 1.7.3 and is actively maintained, though a specific release cadence isn't published, the project shows consistent updates. The library differentiates itself by providing a focused set of utilities, particularly those related to character and string inspection, as exemplified by functions like `isNumberChar`. A key characteristic is its pure ESM distribution, meaning it requires modern JavaScript environments and explicit `import` statements. It also ships with TypeScript type definitions, enabling robust type-checking for TypeScript users, ensuring better code quality and developer experience. The project is part of the broader Codsen ecosystem, aiming for stability and ease of use.","status":"active","version":"1.7.3","language":"javascript","source_language":"en","source_url":"https://github.com/codsen/codsen","tags":["javascript","codsen","utility","helpers","typescript"],"install":[{"cmd":"npm install codsen-utils","lang":"bash","label":"npm"},{"cmd":"yarn add codsen-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add codsen-utils","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library is pure ESM, so CommonJS 'require' is not supported.","wrong":"const { isNumberChar } = require('codsen-utils');","symbol":"isNumberChar","correct":"import { isNumberChar } from 'codsen-utils';"},{"note":"Allows access to all named exports, e.g., `codsenUtils.isNumberChar`. This is ESM-only.","wrong":"const codsenUtils = require('codsen-utils');","symbol":"AllExportedFunctions","correct":"import * as codsenUtils from 'codsen-utils';"},{"note":"Importing types for use in TypeScript. The library ships with its own type definitions.","symbol":"isNumberChar (type)","correct":"import type { isNumberChar } from 'codsen-utils';"}],"quickstart":{"code":"import { strict as assert } from 'assert';\nimport { isNumberChar } from 'codsen-utils';\n\n// Basic checks for identifying number characters\nassert.equal(isNumberChar('z'), false, \"Lowercase letter 'z' is not a number character\");\nassert.equal(isNumberChar('0'), true, \"Digit '0' is a number character\");\nassert.equal(isNumberChar('9'), true, \"Digit '9' is a number character\");\nassert.equal(isNumberChar('A'), false, \"Uppercase letter 'A' is not a number character\");\n\n// Checks for non-numeric symbols and spaces\nassert.equal(isNumberChar('-'), false, \"Hyphen '-' is not a number character\");\nassert.equal(isNumberChar(' '), false, \"Space ' ' is not a number character\");\nassert.equal(isNumberChar('.'), false, \"Dot '.' is not a number character\");\n\n// Demonstrating potential Unicode support (if applicable)\nassert.equal(isNumberChar('٤'), true, \"Arabic-Indic digit '٤' is a number character\");\nassert.equal(isNumberChar('七'), false, \"CJK character '七' is not a basic number digit\");\n\nconsole.log('All isNumberChar assertions passed!');","lang":"typescript","description":"Demonstrates how to import and use the `isNumberChar` function to check various characters."},"warnings":[{"fix":"Ensure your project uses `type: \"module\"` in `package.json` or rename files to `.mjs` extension, and use `import` statements exclusively.","message":"This package is pure ECMAScript Modules (ESM) and does not support CommonJS 'require()' syntax. Attempting to use 'require()' will result in runtime errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade your Node.js environment to version 14.18.0 or newer. NVM (Node Version Manager) is recommended for easy version switching.","message":"The package requires Node.js version 14.18.0 or higher. Running it on older Node.js versions may lead to syntax errors or unexpected behavior due to ESM requirements.","severity":"gotcha","affected_versions":"<14.18.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change `const { symbol } = require('codsen-utils');` to `import { symbol } from 'codsen-utils';` and ensure your project is configured for ESM.","cause":"Attempting to use `require()` to import the ESM-only `codsen-utils` package.","error":"ReferenceError: require is not defined"},{"fix":"Add `\"type\": \"module\"` to your project's `package.json` file, or save your file with a `.mjs` extension.","cause":"Using `import` syntax in a CommonJS context without proper configuration.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Verify your build setup correctly handles ESM imports. Ensure you are importing named exports directly as shown in the quickstart, and avoid default imports unless explicitly exported.","cause":"This error often occurs when transpiling ESM to CommonJS with incorrect Babel/TypeScript settings, or when mixing import styles.","error":"TypeError: (0, _codsen_utils.isNumberChar) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}