chore: filters + cleanup
This commit is contained in:
parent
515da740ba
commit
6005b8ee9a
4 changed files with 3 additions and 27 deletions
|
@ -11,16 +11,12 @@ const BASE_URL = 'https://coryd.dev'
|
|||
|
||||
export default {
|
||||
// general
|
||||
btoa: (string) => {
|
||||
return btoa(string)
|
||||
},
|
||||
encodeAmp: (string) => {
|
||||
if (!string) return
|
||||
const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g
|
||||
const replacement = '&'
|
||||
return string.replace(pattern, replacement)
|
||||
},
|
||||
replaceQuotes: (string) => string.replace(/"/g, "'"),
|
||||
formatNumber: (number) => number.toLocaleString('en-US'),
|
||||
shuffleArray,
|
||||
sanitizeMediaString,
|
||||
|
@ -81,12 +77,6 @@ export default {
|
|||
// links
|
||||
absoluteUrl: (url) => (new URL(url, BASE_URL)).toString(),
|
||||
|
||||
// mastodon
|
||||
mastoUsername: (url) => {
|
||||
const parsedUrl = new URL(url)
|
||||
return `${parsedUrl.pathname.replace('/', '')}@${parsedUrl.host}`
|
||||
},
|
||||
|
||||
// feeds
|
||||
normalizeEntries: (entries, limit) => {
|
||||
const posts = []
|
||||
|
@ -212,14 +202,6 @@ export default {
|
|||
})
|
||||
},
|
||||
calculatePlayPercentage: (plays, mostPlayed) => `${plays/mostPlayed * 100}%`,
|
||||
listToString: (items, key, count = 10) => {
|
||||
const itemData = items.slice(0, count)
|
||||
if (itemData.length === 0) return ''
|
||||
if (itemData.length === 1) return itemData[0][key]
|
||||
const allButLast = itemData.slice(0, -1).map(item => item[key]).join(', ')
|
||||
const last = itemData[itemData.length - 1][key]
|
||||
return `${allButLast} and ${last}`
|
||||
},
|
||||
bookStatus: (books, status) => books.filter(book => book.status === status),
|
||||
bookFavorites: (books) => books.filter(book => book.favorite === true),
|
||||
bookYearLinks: (years) => years.sort((a, b) => b.value - a.value).map((year, index) => {
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "24.4.2",
|
||||
"version": "24.4.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coryd.dev",
|
||||
"version": "24.4.2",
|
||||
"version": "24.4.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cdransf/api-text": "^1.5.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "24.4.2",
|
||||
"version": "24.4.3",
|
||||
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
@ -170,9 +170,3 @@
|
|||
--gray-dark: var(--gray-200);
|
||||
--brand-github: #f5f5f5;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion) {
|
||||
:root {
|
||||
--transition-duration-default: 0.01ms;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue