You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
648 B

export const rupluralize = (value, args, addValue = true) => {
let digit = Math.trunc(value) + '';
digit = digit[digit.length - 1];
return (addValue ? value + ' ' : '') +
args[(+value > 10 && +value < 20)
? 2
: (digit == '1' ? 0 : ('234'.search(digit) > -1 ? 1 : 2))];
};
export const loadScript = (url, onload) => {
return new Promise(resolve => {
const script = document.createElement('script');
script.async = true;
document.body.appendChild(script);
script.onload = function () {
onload && onload.apply(this, arguments);
resolve.apply(this, arguments);
};
script.src = url;
});
};