Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Extract capitalize() into new core util
Browse files Browse the repository at this point in the history
Was never crazy about initial implementation as page component method.

This is a modest start to extracting a common core (#109) and will prove
immediately useful in formatting patron names.
  • Loading branch information
cappadona committed Mar 22, 2019
1 parent 7f4c21f commit 4679ec4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pages/_location/spaces/_category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
<script>
import moment from 'moment'
import { mapState } from 'vuex'
import signage from '~/utils/core'
import labStats from '~/utils/labstats'
import libCal from '~/utils/libcal'
import SpaceAvailability from '~/components/SpaceAvailability'
export default {
head () {
return {
title: this.capitalize(this.$route.params.category),
titleTemplate: this.capitalize(this.$route.params.location) + ' - %s',
title: signage.capitalize(this.$route.params.category),
titleTemplate: signage.capitalize(this.$route.params.location) + ' - %s',
link: [
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Lato:300,400,700' },
// TODO: Use packages for officiaal Vue.js component
Expand Down Expand Up @@ -109,11 +110,6 @@ export default {
category: this.$route.params.category
})
}, 1000 * 60)
},
methods: {
capitalize (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}
}
}
</script>
Expand Down
7 changes: 7 additions & 0 deletions utils/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const core = {
capitalize: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}
}

export default core

0 comments on commit 4679ec4

Please sign in to comment.