{"version":3,"file":"unit.mjs","sourceRoot":"","sources":["../../src/unit.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAoCtD,MAAM,qBACL,KAAa,EACb,IAAY,EACZ,eAA+C,EAC/C,MAAe;IAEf,MAAM,CAAC,kBAAkB,CAAuC,YAAY,EAAE;QAC7E,MAAM;QACN,eAAe;QACf,IAAI;QACJ,KAAK;KACL,CAAC,CAAC;AACJ,CAAC;AAmBD,MAAM,2BACL,IAAY,EACZ,eAA+C,EAC/C,MAAe;IAEf,MAAM,CAAC,kBAAkB,CAAgD,eAAe,EAAE;QACzF,MAAM;QACN,eAAe;QACf,IAAI;KACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import 'globalize';\nimport 'globalize/dist/globalize/unit';\nimport { NumberFormatter } from './number';\nimport { globalizeDelegator } from './util/globalize';\n\nexport type UnitLength = 'long' | 'narrow' | 'short';\n\nexport type UnitFormatterOptions = {\n\t/**\n\t * form: [String] eg. \"long\", \"short\" or \"narrow\".\n\t */\n\tform?: UnitLength;\n\n\t/**\n\t * numberFormatter: [Function] a number formatter function. Defaults to Globalize .numberFormatter() for the current locale using the default options.\n\t */\n\tnumberFormatter?: NumberFormatter;\n};\n\n/**\n * Return a string formatted for the specified number, unit, and options/locale.\n *\n * @param value\n * The number of units.\n *\n * @param unit\n * The unit, singular (e.g., \"day\", \"meter\", \"foot\").\n *\n * @param options\n * An optional configuration object that determines how the number and unit are formatted.\n *\n * @param locale\n * The optional locale. Defaults to the root locale.\n *\n * @return\n * The formatted string.\n */\nexport function formatUnit(value: number, unit: string, options?: UnitFormatterOptions, locale?: string): string;\nexport function formatUnit(value: number, unit: string, locale?: string): string;\nexport function formatUnit(\n\tvalue: number,\n\tunit: string,\n\toptionsOrLocale?: UnitFormatterOptions | string,\n\tlocale?: string\n): string {\n\treturn globalizeDelegator<number, UnitFormatterOptions, string>('formatUnit', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tunit,\n\t\tvalue\n\t});\n}\n\n/**\n * Return a function that formats a number according to specified unit and options/locale.\n *\n * @param unit\n * The unit, singular (e.g., \"day\", \"meter\", \"foot\").\n *\n * @param options\n * An optional configuration object that determines how the number and unit are formatted.\n *\n * @param locale\n * The optional locale. Defaults to the root locale.\n *\n * @return\n * A function that accepts a number and returns a string formatted according to the specified unit and options/locale.\n */\nexport function getUnitFormatter(unit: string, options?: UnitFormatterOptions, locale?: string): NumberFormatter;\nexport function getUnitFormatter(unit: string, locale?: string): NumberFormatter;\nexport function getUnitFormatter(\n\tunit: string,\n\toptionsOrLocale?: UnitFormatterOptions | string,\n\tlocale?: string\n): NumberFormatter {\n\treturn globalizeDelegator<string, UnitFormatterOptions, NumberFormatter>('unitFormatter', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tunit\n\t});\n}\n"]}