Registry / serialization / codsen-utils

codsen-utils

JSON →
library1.7.3jsnpmunverified

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.

npm install codsen-utils
INSTALL
IMPORT
SIG · CODSEN-UTILS
C
codsen-utils
serializationjavascriptv1.7.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

isNumberChar
import { isNumberChar } from 'codsen-utils';
const { isNumberChar } = require('codsen-utils');
The library is pure ESM, so CommonJS 'require' is not supported.
AllExportedFunctions
import * as codsenUtils from 'codsen-utils';
const codsenUtils = require('codsen-utils');
Allows access to all named exports, e.g., `codsenUtils.isNumberChar`. This is ESM-only.
isNumberChar (type)
import type { isNumberChar } from 'codsen-utils';
Importing types for use in TypeScript. The library ships with its own type definitions.

Demonstrates how to import and use the `isNumberChar` function to check various characters.

import { strict as assert } from 'assert'; import { isNumberChar } from 'codsen-utils'; // Basic checks for identifying number characters assert.equal(isNumberChar('z'), false, "Lowercase letter 'z' is not a number character"); assert.equal(isNumberChar('0'), true, "Digit '0' is a number character"); assert.equal(isNumberChar('9'), true, "Digit '9' is a number character"); assert.equal(isNumberChar('A'), false, "Uppercase letter 'A' is not a number character"); // Checks for non-numeric symbols and spaces assert.equal(isNumberChar('-'), false, "Hyphen '-' is not a number character"); assert.equal(isNumberChar(' '), false, "Space ' ' is not a number character"); assert.equal(isNumberChar('.'), false, "Dot '.' is not a number character"); // Demonstrating potential Unicode support (if applicable) assert.equal(isNumberChar('٤'), true, "Arabic-Indic digit '٤' is a number character"); assert.equal(isNumberChar('七'), false, "CJK character '七' is not a basic number digit"); console.log('All isNumberChar assertions passed!');
Debug
Known issues
breakingThis package is pure ECMAScript Modules (ESM) and does not support CommonJS 'require()' syntax. Attempting to use 'require()' will result in runtime errors.
fix
Ensure your project uses `type: "module"` in `package.json` or rename files to `.mjs` extension, and use `import` statements exclusively.
affects: >=1.0.0
gotchaThe 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.
fix
Upgrade your Node.js environment to version 14.18.0 or newer. NVM (Node Version Manager) is recommended for easy version switching.
affects: <14.18.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` to import the ESM-only `codsen-utils` package.
fix
Change `const { symbol } = require('codsen-utils');` to `import { symbol } from 'codsen-utils';` and ensure your project is configured for ESM.
SyntaxError: Cannot use import statement outside a module
Using `import` syntax in a CommonJS context without proper configuration.
fix
Add `"type": "module"` to your project's `package.json` file, or save your file with a `.mjs` extension.
TypeError: (0, _codsen_utils.isNumberChar) is not a function
This error often occurs when transpiling ESM to CommonJS with incorrect Babel/TypeScript settings, or when mixing import styles.
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.
Upgrade
Version history
1.7.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
codsen-utils — npm install codsen-utils · libregistry