Nuxt/docs/utils/createTitle.js
Krutie Patel f82a4b67a3
docs(api): add defineNuxtComponent utils (#7618)
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
2022-09-20 11:09:29 +02:00

6 lines
274 B
JavaScript

import { splitByCase, upperFirst } from 'scule'
export default (title, link) => {
return title || (link.startsWith('http') && link) || link.split(/[/#]/).filter(Boolean).map(part => splitByCase(part).map(p => upperFirst(p)).join(' ')).join(' > ').replace('Api', 'API')
}