API Reference
41 APIs across 11 namespaces. All functions are pure, deterministic, and zero-dependency.
country
| API | Summary | Tags |
|---|---|---|
| country | Look up a country by any identifier format (alpha-2, alpha-3, numeric, or English name) and return a rich ISO 3166-1 / CLDR 48 Country object. | countryiso-3166cldr |
datetime
| API | Summary | Tags |
|---|---|---|
| datetime.delta | Compute the time difference between two timestamps in milliseconds or seconds per ISO 8601. | datetimetime-differenceduration |
| datetime.toISO | Format a Date or millisecond timestamp to a UTC ISO 8601 string with configurable precision. | datetimeiso8601formatting |
equal
| API | Summary | Tags |
|---|---|---|
| equal.bool | Boolean equality per ECMA-262 ToBoolean semantics with normalization of diverse boolean representations (true/false, 0/1, strings). | equalitybooleannormalization |
| equal.literal | Equality comparison per ECMA-262 strict equality with string trimming (E-01) and no type coercion. | equalitycomparisontrimming |
| equal.numeric | Numeric equality per ECMA-262 Number coercion, rejecting hex/binary/octal notation for safety. | equalitynumericcomparison |
format
| API | Summary | Tags |
|---|---|---|
| format.creditCard | Format a credit card number with brand-aware digit grouping per ISO/IEC 7812 BIN prefix detection. | formatcredit-cardpayment |
| format.digits | Format a digit string according to a pattern where '#' represents a digit slot, per ECMA-262 String processing. | formatdigitspattern |
| format.iban | Format an IBAN (International Bank Account Number) in groups of 4 per ISO 13616. | formatibanbanking |
| format.phone | Format a phone number for human-readable display with country-specific grouping, per ITU-T E.164 and RFC 3966. | formatphonee164 |
http.etag
| API | Summary | Tags |
|---|---|---|
| http.etag.formatETag | Format an ETag object to its RFC 9110 §8.8.3 HTTP header string representation. | httpetagformatting |
| http.etag.formatIfNoneMatch | Format an IfNoneMatch object to its RFC 9110 §13.1.2 HTTP header string. | httpetagformatting |
| http.etag.matchesIfNoneMatch | Check if a current ETag matches an If-None-Match header value using weak comparison per RFC 9110 §13.1.2. | httpetag304 |
| http.etag.parseETag | Parse a single ETag header value into a structured { weak, value } object per RFC 9110 §8.8.3. | httpetagcaching |
| http.etag.parseIfNoneMatch | Parse an If-None-Match header value into a structured IfNoneMatch object per RFC 9110 §13.1.2. | httpetagif-none-match |
| http.etag.strongEqual | Strong ETag comparison: both must be strong (weak === false) and values must match per RFC 9110 §8.8.3.2. | httpetagcomparison |
| http.etag.weakEqual | Weak ETag comparison: compares opaque-tag values ignoring the weak/strong flag per RFC 9110 §8.8.3.2. | httpetagcomparison |
locale
| API | Summary | Tags |
|---|---|---|
| locale.canonicalize | Canonicalize a BCP 47 locale tag to a stable string representation. | localenormalizationbcp47 |
| locale.equal | Compare two BCP 47 locale tags for equality per RFC 5646 §2.1.1 case-insensitivity rules. | localecomparisonbcp47 |
money
| API | Summary | Tags |
|---|---|---|
| money.add | Add two Money values with same-currency and same-scale enforcement per ISO 4217. | moneyarithmeticbigint |
| money.format | Format an ISO 4217 Money object to its string representation using string-based division for exact output. | moneyformattingbigint |
| money.parse | Parse a monetary string into a bigint-based Money object with ISO 4217 currency awareness. | moneyparsingbigint |
| money.sub | Subtract two Money values with same-currency and same-scale enforcement per ISO 4217. | moneyarithmeticbigint |
qty
| API | Summary | Tags |
|---|---|---|
| qty.add | Add two Quantity values with same-unit enforcement (case-sensitive comparison). | quantityarithmeticaddition |
| qty.parse | Parse a UCUM-compatible quantity string into a { value, unit } object using greedy numeric prefix extraction. | quantityparsingmeasurement |
| qty.sub | Subtract two Quantity values with same-unit enforcement (case-sensitive comparison). | quantityarithmeticsubtraction |
query
| API | Summary | Tags |
|---|---|---|
| query.canonicalParams | Produce a canonical query string sorted by key then by value for deterministic output per RFC 3986. | query-stringcanonicalsorting |
| query.parse | Parse a URL query string into a key-value record, handling both WHATWG (+) and RFC 3986 (%20) space encoding. | query-stringparsingurl |
| query.stringify | Serialize an object into a URL query string with configurable encoding (WHATWG or RFC 3986) and array mode. | query-stringserializationurl |
redact
| API | Summary | Tags |
|---|---|---|
| redact.creditCard | Redact a credit card number by masking all digits except the last 4, preserving separators, per PCI DSS Requirement 3.4. | redactcredit-cardpci-dss |
| redact.email | Redact an RFC 5321 email address by masking the local part while preserving the domain, per GDPR data minimization principles. | redactemailpii |
| redact.ipAddress | Redact an IP address per RFC 6235 by masking the host portion, consistent with GDPR /24 (IPv4) and /48 (IPv6) truncation practice. | redactipipv4 |
| redact.matchFieldType | Detect a PCI/GDPR-relevant PII field type from a field name using exact-match lookup against a built-in name map. | redactfield-detectionpii |
| redact.phone | Redact a phone number using ITU-T E.164 structure awareness, preserving country code and last 4 subscriber digits. | redactphonepii |
| redact.redactObject | Redact specified fields in an object by dot-path, applying PCI/GDPR-compliant strategy-aware PII masking with structural sharing. | redactobjectpii |
| redact.token | Redact a token or API key with configurable head/tail preservation, per PCI DSS data security principles. | redacttokenapi-key |
url
| API | Summary | Tags |
|---|---|---|
| url.isAbsolute | Check whether a URL string is absolute (has a scheme:// prefix) per RFC 3986 §3.1. | urlvalidationscheme |
| url.join | Join URL path segments with path-join semantics and optional query parameter merging per RFC 3986. | urlpath-joinquery-string |
| url.normalize | Normalize a URL string via the WHATWG URL parser for spec-compliant canonicalization. | urlnormalizationwhatwg |
| url.stripQuery | Remove the RFC 3986 query string and fragment from a URL, returning only the path portion. | urlquery-stringstrip |
| url.withQuery | Set or merge query parameters on a URL string with three merge strategies per RFC 3986 §3.4. | urlquery-stringmerge |