Registry / productivity / hungarian-nameformat

hungarian-nameformat

JSON →
library1.0.0jsnpmunverified

A lightweight utility for converting names between Hungarian and Western formatting conventions. Current version 1.0.0, stable and simple, no external dependencies. It handles compound surnames and preserves casing. Alternatives exist as part of larger internationalization libraries, but this is a focused, zero-dependency solution for Hungarian name formatting.

npm install hungarian-nameformat
INSTALL
IMPORT
SIG · HUNGARIAN-NAMEFORM
H
hungarian-nameformat
productivityjavascriptv1.0.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.

toHungarianFormat
import { toHungarianFormat } from '@yourusername/hungarian-nameformat'
const toHungarianFormat = require('@yourusername/hungarian-nameformat')
ESM-only; package has no default export and does not support CommonJS require()
toWesternFormat
import { toWesternFormat } from '@yourusername/hungarian-nameformat'
import toWesternFormat from '@yourusername/hungarian-nameformat'
Function is a named export; default import is undefined
both functions
import { toHungarianFormat, toWesternFormat } from '@yourusername/hungarian-nameformat'
import * as hun from '@yourusername/hungarian-nameformat'
Namespace import works but is uncommon; prefer named imports

Demonstrates converting names between Hungarian and Western formats, including compound surnames.

import { toHungarianFormat, toWesternFormat } from '@yourusername/hungarian-nameformat' const hungarianName = toHungarianFormat('János Kovács') console.log(hungarianName) // 'Kovács János' const westernName = toWesternFormat('Kovács János') console.log(westernName) // 'János Kovács' // Compound surnames: console.log(toHungarianFormat('János Kovács-Nagy')) // 'Kovács-Nagy János' console.log(toWesternFormat('Kovács-Nagy János')) // 'János Kovács-Nagy'
Debug
Known issues
gotchaInput with both a space and a dash (e.g., 'János Kovács-Nagy') is split by the space, treating the dash as part of the last name.
fix
Be aware that the dash is not a delimiter; only space separates first and last name.
affects: *
gotchaThe package does not auto-capitalize names. Input casing is preserved as is.
fix
Ensure names are properly capitalized before passing to the functions, or post-process the result.
affects: *
gotchaNames with more than one space or more than one dash will throw an error. Only single-space-separated first and last names are supported.
fix
Validate that the name has exactly one space and no extra dashes, or split manually.
affects: *
gotchaPackage is ESM-only; does not support CommonJS require().
fix
Use import syntax or ensure your project is configured for ESM.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Expected a string
Input to toHungarianFormat or toWesternFormat is not a string (e.g., undefined, object, number).
fix
Ensure the argument is a string: toHungarianFormat(String(name))
TypeError: Unsupported format
Input contains more than one space or more than one dash (e.g., 'János Kovács Béla' or 'Kovács--Nagy').
fix
Pass only a single space-separated first and last name, and avoid multiple dashes.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
hungarian-nameformat — npm install hungarian-nameformat · libregistry