0
0
Fork 0

Create prototype for title casing

This commit is contained in:
Tyler-A 2020-08-06 23:11:28 -06:00
parent f75a897648
commit 168961e779
2 changed files with 13 additions and 0 deletions

View file

@ -11,6 +11,9 @@
</template>
<script>
// Import Misc JS things
import "./js/prototypes.js";
// Import components
import LoginCard from './components/LoginView.vue';
import MainView from './components/MainView.vue';

10
src/js/prototypes.js vendored Normal file
View file

@ -0,0 +1,10 @@
String.prototype.toTitleCase = function () {
let words = this.split(` `);
let new_words = [];
for (var word of words) {
new_words.push(
`${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`
);
};
return new_words.join(` `);
}