Skip to content

Instantly share code, notes, and snippets.

@ndabAP
Last active June 5, 2018 12:45
Show Gist options
  • Save ndabAP/e7f13dd4a2ee6f33574484475925c95e to your computer and use it in GitHub Desktop.
Save ndabAP/e7f13dd4a2ee6f33574484475925c95e to your computer and use it in GitHub Desktop.
Vue.js case
// It might be that you need components loaded dynamically. You can use the following function
const getComponentName = (identifier, method = 'post') => {
return `${identifier.replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-(.*)$/, '$1')}-${method}`
}
// Example: getComponentName('PriceTable', 'get') yields 'price-table-get'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment