Rewrite phase 1.
Started improved client code structure. Implemented session based authentication serverside. Implemented user, match, and sport database models serverside. Implemented Controllers for variety of C and R operations of CRUD.
This commit is contained in:
22
sports-matcher/client/src/utils/strings.js
Normal file
22
sports-matcher/client/src/utils/strings.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export function grammaticalListString(items, max) {
|
||||
if (!items) return null;
|
||||
if (max < 1) return "";
|
||||
let built = "";
|
||||
|
||||
let index = 0;
|
||||
items.forEach(item => {
|
||||
if (index > max) {
|
||||
built += "and " + items.length + " more ";
|
||||
return;
|
||||
}
|
||||
built += item;
|
||||
built += ", ";
|
||||
if (index == max - 1) {
|
||||
built += "and ";
|
||||
}
|
||||
|
||||
index += 1;
|
||||
});
|
||||
|
||||
return built;
|
||||
}
|
Reference in New Issue
Block a user