Registry / devops / sm-utility

sm-utility

JSON →
library2.4.29jsnpmunverified

Reusable utility codes for internal SmariTrips projects, bundled with TypeScript types. Version 2.4.29 is the current stable release. It provides common helpers (e.g., date formatting, number parsing) to standardize code across the company. No external dependencies. Unlike broader libraries (lodash, date-fns), it is purpose-built for SM's internal conventions and is not intended for public use. Development is ongoing within the organization, with npm link as the primary install method.

npm install sm-utility
INSTALL
IMPORT
SIG · SM-UTILITY
S
sm-utility
devopsjavascriptv2.4.29
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.

formatDate
import { formatDate } from 'sm-utility'
import formatDate from 'sm-utility'
All exports are named – no default export.
parseNumber
import { parseNumber } from 'sm-utility'
const parseNumber = require('sm-utility').parseNumber
ESM-only package; require() will not work. Use dynamic import() if needed in CJS.
type Helpers
import type { Helpers } from 'sm-utility'
TypeScript types are bundled, but type-only import is optional – runtime exports also exist.

Shows importing and using `formatDate` and `parseNumber` with custom locale-aware formatting.

import { formatDate, parseNumber } from 'sm-utility'; const date = formatDate('2024-01-15', 'DD/MM/YYYY'); console.log(date); // '15/01/2024' const num = parseNumber('1.234,56'); console.log(num); // 1234.56
Debug
Known issues
gotchaPackage is ESModule-only; it cannot be required() in CommonJS.
fix
Use dynamic import() or configure Node.js to load ESM packages.
affects: >=2.0.0
gotchaAll functions have locale-specific behavior (pt-BR assumed). Working with non-BR dates/numbers may produce unexpected results.
fix
Verify expected locale; the package is designed for Brazilian Portuguese.
affects: *
deprecatedFunction `toCurrency` is deprecated in 2.4.0+ in favor of `formatCurrency`.
fix
Replace `toCurrency` calls with `formatCurrency`.
affects: >=2.4.0
Errors
Common errors & fixes
Cannot find module 'sm-utility' or its corresponding type declarations.
Missing installation or package not linked locally.
fix
Run `npm link path-to/sm-utils` or install from registry with `npm install sm-utility`.
ERR_REQUIRE_ESM: require() of ES Module
The package is ESM-only, but a require() was used.
fix
Replace `require('sm-utility')` with `import('sm-utility')` or use an ESM wrapper.
Uncaught TypeError: date is not a function
Importing the default export, but there is no default export.
fix
Use named import: `import { formatDate } from 'sm-utility'`.
Upgrade
Version history
2.4.29latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
OpenAI (training)
1
Resources
sm-utility — npm install sm-utility · libregistry