This commit is contained in:
Azgaar 2020-06-06 17:39:33 +03:00
parent 7e25012e0f
commit 164f593b75
2 changed files with 10 additions and 4 deletions

View file

@ -416,6 +416,12 @@ function getAdjective(string) {
// get ordinal out of integer: 1 => 1st
const nth = n => n+(["st","nd","rd"][((n+90)%100-10)%10-1]||"th");
// conjunct array: [A,B,C] => "A, B and C"
function list(array) {
const conjunction = new Intl.ListFormat(window.lang || "en", {style:"long", type:"conjunction"});
return conjunction.format(array);
}
// split string into 2 almost equal parts not breaking words
function splitInTwo(str) {
const half = str.length / 2;