diff options
author | 2021-08-10 01:24:25 +0100 | |
---|---|---|
committer | 2021-09-06 01:21:39 -0700 | |
commit | d321d8366b597e46ff8e3fc63d17622a9297505c (patch) | |
tree | 339775403be469fdc9c53c4f9484c8ba7c23811a /docs/src/components/Examples/Functions/format-name.js | |
parent | e686c3c50469d18db93da7ce79ddcac8659c3166 (diff) | |
download | astro-d321d8366b597e46ff8e3fc63d17622a9297505c.tar.gz astro-d321d8366b597e46ff8e3fc63d17622a9297505c.tar.zst astro-d321d8366b597e46ff8e3fc63d17622a9297505c.zip |
Adds examples page
Diffstat (limited to 'docs/src/components/Examples/Functions/format-name.js')
-rw-r--r-- | docs/src/components/Examples/Functions/format-name.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/src/components/Examples/Functions/format-name.js b/docs/src/components/Examples/Functions/format-name.js new file mode 100644 index 000000000..890275c9d --- /dev/null +++ b/docs/src/components/Examples/Functions/format-name.js @@ -0,0 +1,24 @@ +import capitalise from './capitalise' + +/** + * + * @param {String} name + * @returns Formats the Template Name + */ +export default function formatName(name){ + return name.includes('multiple') + ? + `${capitalise(name.split('-')[1])} ${capitalise(name.split('-')[0])}'s` + : + name + .split('-') + .map((str)=>( + str.replace('with','') + )) + .map((str)=>( + str.replace('framework','') + )) + .map((str)=>(capitalise(str))) + .join(' ') + .trim() +}
\ No newline at end of file |