Measurement UX,
not unit math.
Parse messy human measurements, normalize mixed units, suggest typos, validate form rules, and explain every conversion for production apps.
import { parseMixedMeasurement, normalizeMixedMeasurement } from "@coreify/unit";
parseMixedMeasurement("5 ft 7 in");
// -> {
"terms": [
{
"value": 5,
"unit": "ft",
"rawUnit": "ft",
"decimalPlaces": 0
},
{
"value": 7,
"unit": "in",
"rawUnit": "in",
"decimalPlaces": 0
}
],
"category": "length",
"raw": "5 ft 7 in"
}
normalizeMixedMeasurement("২ মি ৩০ সেমি", "cm");
// -> 230Mixed input
Parse natural measurements like 5 ft 7 in, 1 kg 250 g, or ২ মি ৩০ সেমি.
Smart output
Pick readable units, preserve precision choices, and expose conversion trace and regional-unit warnings.
Form-grade rules
Validate category, allowed units, decimals, ranges, and typos before data touches DB.
Parse
Resolve aliases, Bangla labels, mixed units, and decimal rules before data moves deeper.
Trace
Keep factor path, base value, rounding status, and warnings for forms, logs, and audits.
Present
Return best unit, canonical or localized labels, strict formatting, and useful schema errors.
Built for app flows, not demo conversions.
Most packages convert one number. Production apps need strict input, explainable output, predictable UI states, and responsive surfaces.
Mixed measurements
Use one parser for 5 ft 7 in, 1 kg 250 g, ২ মি ৩০ সেমি, and land units.
Auditable conversions
Show raw value, rounded value, warnings, and status instead of hiding precision loss.
Optional localization
Default flows stay canonical and predictable. Add Bangla digits, labels, and aliases only when product needs them.
Form-ready validation
Category, unit whitelist, min/max, decimal caps, required fields, typo suggestions.
FAQ
Short answers for architecture, optional localization, precision, and layout.
Most libs stop at factor math. Unit handles mixed input parsing, localized aliases, best-unit output, typo suggestion, schema validation, and conversion traces.
Ship measurement flows that explain themselves.
Parse user intent, normalize safely, keep trace data, and render localized output only when app opts in from one package.