mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
chore: format files with prettier
This commit is contained in:
@@ -3,6 +3,6 @@ import type { MarkdownInstance } from "astro";
|
||||
import type { Frontmatter } from "../types";
|
||||
|
||||
const getPostsByTag = (posts: MarkdownInstance<Frontmatter>[], tag: string) =>
|
||||
posts.filter((post) => slufigyAll(post.frontmatter.tags).includes(tag));
|
||||
posts.filter(post => slufigyAll(post.frontmatter.tags).includes(tag));
|
||||
|
||||
export default getPostsByTag;
|
||||
|
||||
@@ -5,9 +5,9 @@ import type { Frontmatter } from "../types";
|
||||
const getUniqueTags = (posts: MarkdownInstance<Frontmatter>[]) => {
|
||||
let tags: string[] = [];
|
||||
const filteredPosts = posts.filter(({ frontmatter }) => !frontmatter.draft);
|
||||
filteredPosts.forEach((post) => {
|
||||
filteredPosts.forEach(post => {
|
||||
tags = [...tags, ...post.frontmatter.tags]
|
||||
.map((tag) => slugifyStr(tag))
|
||||
.map(tag => slugifyStr(tag))
|
||||
.filter(
|
||||
(value: string, index: number, self: string[]) =>
|
||||
self.indexOf(value) === index
|
||||
|
||||
@@ -8,6 +8,6 @@ export const slugifyStr = (str: string) => slugger(str);
|
||||
const slugify = (frontmatter: Frontmatter) =>
|
||||
frontmatter.slug ? slugger(frontmatter.slug) : slugger(frontmatter.title);
|
||||
|
||||
export const slufigyAll = (arr: string[]) => arr.map((str) => slugifyStr(str));
|
||||
export const slufigyAll = (arr: string[]) => arr.map(str => slugifyStr(str));
|
||||
|
||||
export default slugify;
|
||||
|
||||
Reference in New Issue
Block a user