i hate moving code

it's so tedious having to delete the code and paste it into another file and update the github on both steps
This commit is contained in:
Laetitia (O-01-67) 2022-12-20 10:00:52 -05:00 committed by GitHub
parent 514af575a5
commit 3f42b3eab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -108,6 +108,19 @@
return tempArray;
};
function tryJoin(stringOrArray,joiner) {
//console.log(`tryJoin: ${stringOrArray}`);
if(typeof(stringOrArray) === "string") {
//console.log("tryJoin: String");
return stringOrArray;
} else if(Array.isArray(stringOrArray)) {
//console.log("tryJoin: Array");
return stringOrArray.join(joiner);
} else {
throw new TypeError(`Unexpected type: ${typeof(stringOrArray)}`);
};
};
//Checks
//Element exists in the elements object