@taxbit/utilities
v0.2.4
Published
Taxbit Utilities
Downloads
2,484
Readme
Taxbit Utilities
Options Functions
Options functions will return an array of objects with a label and value property
import {
getCaProvinceOptions,
getCountryOptions,
getMonthOptions,
getUsStateOptions,
} from '@taxbit/utilities';
Example
getCountryOptions('en'); // [{ value: 'AF', label: 'Afghanistan' }, ...]
Code Arrays
Code arrays are available for direct import, these are arrays of allowed ISO values for country, US state, and CA province.
For months, the array is an array of strings "01", "02", ... "12".
import {
caProvinceCodes,
countryCodes,
monthCodes,
usStateCodes,
} from '@taxbit/utilities';
Example
countryCodes; // ['AF', 'AX', 'AL', ...]
Label Functions
Label functions will accept a code and language parameter. Language is optional and defaults to 'en'.
import {
getCaProvinceLabel,
getCountryLabel,
getMonthLabel,
getUsStateLabel,
} from '@taxbit/utilities';
Example
getCountryLabel('AL', 'fr'); // 'Albanie'