19 lines
406 B
JavaScript
19 lines
406 B
JavaScript
|
exports.createArticleSlug = ({
|
||
|
username = '',
|
||
|
slugPart = '',
|
||
|
shortId = ''
|
||
|
} = {}) => {
|
||
|
if (!username || !slugPart || !shortId) {
|
||
|
throw new Error(`
|
||
|
createArtcileSlug: One or more properties were missing, all are required
|
||
|
|
||
|
{
|
||
|
username: ${username},
|
||
|
slugPart: ${slugPart},
|
||
|
shortId: ${shortId}
|
||
|
}
|
||
|
`);
|
||
|
}
|
||
|
return `/news/${username}/${slugPart.concat('--', shortId)}`;
|
||
|
};
|