handsontable
Version:
Handsontable is a JavaScript Data Grid available for React, Angular and Vue.
29 lines (27 loc) • 908 B
JavaScript
import { staticRegister } from "./../../utils/staticRegister.mjs";
import pluralizeFn from "./pluralize.mjs";
import substituteFn from "./substituteVariables.mjs";
const {
register: registerGloballyPhraseFormatter,
getValues: getGlobalPhraseFormatters
} = staticRegister('phraseFormatters');
/**
* Register phrase formatter.
*
* @param {string} name Name of formatter.
* @param {Function} formatterFn Function which will be applied on phrase propositions. It will transform them if it's possible.
*/
export function register(name, formatterFn) {
registerGloballyPhraseFormatter(name, formatterFn);
}
/**
* Get all registered previously formatters.
*
* @returns {Array}
*/
export function getAll() {
return getGlobalPhraseFormatters();
}
export { register as registerPhraseFormatter, getAll as getPhraseFormatters };
register('pluralize', pluralizeFn);
register('substitute', substituteFn);