Registry / productivity / br-address-formatter

br-address-formatter

JSON →
library1.3.0jsnpmunverified

A simple Node.js library that formats Brazilian address objects into a Google-style formatted string. It takes an object with fields like street, number, neighborhood, city, state, and postalCode and returns a human-readable address string. Current version 1.3.0, no active development cadence indicated. Differentiates by being focused solely on Brazilian address format with minimal API surface.

npm install br-address-formatter
INSTALL
IMPORT
SIG · BR-ADDRESS-FORMATT
B
br-address-formatter
productivityjavascriptv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
const brAddressFormatter = require('br-address-formatter')
import brAddressFormatter from 'br-address-formatter'
Package uses CommonJS; no ESM build available.
brAddressFormatter
const brAddressFormatter = require('br-address-formatter')
const { brAddressFormatter } = require('br-address-formatter')
Package exports a single function as default, not a named export.
brAddressFormatter
import brAddressFormatter from 'br-address-formatter' (with bundler/ESM)
import { brAddressFormatter } from 'br-address-formatter'
If using ESM, must use default import. Named import will fail.

Shows how to import and use the library to format a Brazilian address object into a string.

const brAddressFormatter = require('br-address-formatter'); const address = { postalCode: '15085480', street: 'Rua dos Pinheiros', number: '383', neighborhood: 'Pinheiros', city: 'São Paulo', state: 'São Paulo' }; const formatted = brAddressFormatter(address); console.log(formatted); // 'Rua dos Pinheiros, 383 - Pinheiros, São Paulo - São Paulo, 15085-480'
Debug
Known issues
gotchaThe function expects an object with specific keys; unknown keys are ignored.
fix
Ensure object contains only documented keys: street, number, complement, neighborhood, city, state, postalCode (or zipCode alias).
affects: >=1.0.0
gotchaThe library does not handle international addresses; only Brazilian format is supported.
fix
Do not use for addresses outside Brazil.
affects: >=1.0.0
gotchaNo TypeScript typings included; using in TypeScript requires manual declaration or @types package.
fix
Create a .d.ts file: declare module 'br-address-formatter' { function brAddressFormatter(address: Record<string, string>): string; export default brAddressFormatter; }
affects: >=1.0.0
gotchaThe postalCode field expects numbers without hyphen; it will format as XXXXX-XXX. Providing hyphenated input may result in unexpected output.
fix
Pass postal code as digits only (e.g., '15085480') and let the library add the hyphen.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: brAddressFormatter is not a function
Using named import instead of default import in CommonJS.
fix
Use const brAddressFormatter = require('br-address-formatter'); instead of const { brAddressFormatter } = require('br-address-formatter');
TypeError: Cannot read properties of undefined (reading 'format')
Passing undefined or null as argument.
fix
Always pass an object (empty if needed): brAddressFormatter({})
SyntaxError: Unexpected token 'export'
Trying to import the CommonJS module using ESM import syntax without a bundler/ESM compatibility.
fix
Use require() or configure a bundler that can handle CommonJS.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
br-address-formatter — npm install br-address-formatter · libregistry