add toPluralOrSingular string util

pull/98/head
dperolio 2 years ago
parent f39ab0e760
commit 57e99392b6
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -18,9 +18,9 @@ const _warn = (labels, ...message) => warn({ labels, message });
const _error = (labels, ...message) => error({ labels, message });
/**
*
* @param {*} text
* @returns
*
* @param {*} text
* @returns
*/
export const isSingular = text => {
try {
@ -31,9 +31,9 @@ export const isSingular = text => {
};
/**
*
* @param {*} text
* @returns
*
* @param {*} text
* @returns
*/
export const isPlural = text => {
try {
@ -44,9 +44,9 @@ export const isPlural = text => {
};
/**
*
* @param {*} text
* @returns
*
* @param {*} text
* @returns
*/
export const toSingular = text => {
try {
@ -57,9 +57,9 @@ export const toSingular = text => {
};
/**
*
* @param {*} text
* @returns
*
* @param {*} text
* @returns
*/
export const toPlural = text => {
try {
@ -70,10 +70,23 @@ export const toPlural = text => {
};
/**
*
* @param {*} text
* @param {*} numberOfCharacters
* @returns
*
* @param {*} text
* @returns
*/
export const toPluralOrSingular = (text, count) => {
try {
return pluralize(text, count);
} catch (err) {
return _error(_labels.concat('toPluralOrSingular'), err);
}
};
/**
*
* @param {*} text
* @param {*} numberOfCharacters
* @returns
*/
export const chunkText = (text, numberOfCharacters) => {
try {
@ -84,9 +97,9 @@ export const chunkText = (text, numberOfCharacters) => {
};
/**
*
* @param {*} text
* @returns
*
* @param {*} text
* @returns
*/
export const toHash = text => {
try {
@ -300,9 +313,9 @@ export const assertString = input => {
};
/**
*
* @param {*} length
* @returns
*
* @param {*} length
* @returns
*/
export const getRandomString = length => {
try {

Loading…
Cancel
Save