Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbapapazes committed Jan 22, 2023
1 parent 7804dc1 commit 861f794
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/runtime/server/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ export const getContent = async (event: H3Event, id: string): Promise<ParsedCont

const parsed = await parseContent(contentId, body as string) as ParsedContent

await cacheParsedStorage.setItem(id, { parsed, hash }).catch(() => { })
await cacheParsedStorage.setItem(id, { parsed, hash }).catch(() => {})

return parsed
}

/**
* Parse content file using registered plugins
*/
export async function parseContent(id: string, content: string, opts: ParseContentOptions = {}) {
export async function parseContent (id: string, content: string, opts: ParseContentOptions = {}) {
const nitroApp = useNitroApp()
const options = defu(
opts,
Expand Down Expand Up @@ -200,7 +200,7 @@ export const createServerQueryFetch = <T = ParsedContent>(event: H3Event) => (qu
export function serverQueryContent<T = ParsedContent>(event: H3Event): QueryBuilder<T>;
export function serverQueryContent<T = ParsedContent>(event: H3Event, params?: QueryBuilderParams): QueryBuilder<T>;
export function serverQueryContent<T = ParsedContent>(event: H3Event, query?: string, ...pathParts: string[]): QueryBuilder<T>;
export function serverQueryContent<T = ParsedContent>(event: H3Event, query?: string | QueryBuilderParams, ...pathParts: string[]) {
export function serverQueryContent<T = ParsedContent> (event: H3Event, query?: string | QueryBuilderParams, ...pathParts: string[]) {
const queryBuilder = createQuery<T>(createServerQueryFetch(event), typeof query !== 'string' ? query || {} : {})
let path: string

Expand All @@ -216,8 +216,8 @@ export function serverQueryContent<T = ParsedContent>(event: H3Event, query?: st
if (path) {
params.where = params.where || []
if (params.first && (params.where || []).length === 0) {
// If query contains `path` and does not contain any `where` condition
// Then can use `path` as `where` condition to find exact match
// If query contains `path` and does not contain any `where` condition
// Then can use `path` as `where` condition to find exact match
params.where.push({ _path: withoutTrailingSlash(path) })
} else {
params.where.push({ _path: new RegExp(`^${path.replace(/[-[\]{}()*+.,^$\s/]/g, '\\$&')}`) })
Expand Down

0 comments on commit 861f794

Please sign in to comment.