@d3plus/format
Version: 
JavaScript formatters for localized numbers and dates.
12 lines (11 loc) • 489 B
JavaScript
import abbreviate from "./formatAbbreviate.js";
import { format } from "d3-format";
/**
    @function format
    @desc An extension to d3's [format](https://github.com/d3/d3-format#api-reference) function that adds more string formatting types and localizations.
    @param {String} specifier The string specifier used by the format function.
    @returns {Function}
*/ export default function(specifier) {
    if (specifier === ".3~a") return abbreviate;
    return format(specifier);
};