{"id":18795,"library":"sm-utility","title":"sm-utility","description":"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.","status":"active","version":"2.4.29","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install sm-utility","lang":"bash","label":"npm"},{"cmd":"yarn add sm-utility","lang":"bash","label":"yarn"},{"cmd":"pnpm add sm-utility","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"All exports are named – no default export.","wrong":"import formatDate from 'sm-utility'","symbol":"formatDate","correct":"import { formatDate } from 'sm-utility'"},{"note":"ESM-only package; require() will not work. Use dynamic import() if needed in CJS.","wrong":"const parseNumber = require('sm-utility').parseNumber","symbol":"parseNumber","correct":"import { parseNumber } from 'sm-utility'"},{"note":"TypeScript types are bundled, but type-only import is optional – runtime exports also exist.","wrong":"","symbol":"type Helpers","correct":"import type { Helpers } from 'sm-utility'"}],"quickstart":{"code":"import { formatDate, parseNumber } from 'sm-utility';\n\nconst date = formatDate('2024-01-15', 'DD/MM/YYYY');\nconsole.log(date); // '15/01/2024'\n\nconst num = parseNumber('1.234,56');\nconsole.log(num); // 1234.56","lang":"typescript","description":"Shows importing and using `formatDate` and `parseNumber` with custom locale-aware formatting."},"warnings":[{"fix":"Use dynamic import() or configure Node.js to load ESM packages.","message":"Package is ESModule-only; it cannot be required() in CommonJS.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Verify expected locale; the package is designed for Brazilian Portuguese.","message":"All functions have locale-specific behavior (pt-BR assumed). Working with non-BR dates/numbers may produce unexpected results.","severity":"gotcha","affected_versions":"*"},{"fix":"Replace `toCurrency` calls with `formatCurrency`.","message":"Function `toCurrency` is deprecated in 2.4.0+ in favor of `formatCurrency`.","severity":"deprecated","affected_versions":">=2.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm link path-to/sm-utils` or install from registry with `npm install sm-utility`.","cause":"Missing installation or package not linked locally.","error":"Cannot find module 'sm-utility' or its corresponding type declarations."},{"fix":"Replace `require('sm-utility')` with `import('sm-utility')` or use an ESM wrapper.","cause":"The package is ESM-only, but a require() was used.","error":"ERR_REQUIRE_ESM: require() of ES Module"},{"fix":"Use named import: `import { formatDate } from 'sm-utility'`.","cause":"Importing the default export, but there is no default export.","error":"Uncaught TypeError: date is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}