UNPKG

poststore

Version:

PostStore can be used with NEXT.JS to create markdown-based blogs.

29 lines (28 loc) 2.22 kB
import crypto from 'crypto'; import { FileNode, CategoryNode, PostNode } from '../typings'; import { Path } from '../typings'; export declare const isCategoryNode: (node: FileNode) => node is CategoryNode; export declare const isPostNode: (node: FileNode) => node is PostNode; export declare const findCategory: (rootNode: FileNode, categories: string[]) => FileNode; export declare const getPostsAll: (rootNode: FileNode) => PostNode[]; export declare const getCategoriesAll: (rootNode: FileNode) => FileNode[]; export declare const getTagsAll: (rootNode: FileNode) => string[]; export declare const getPostBy: (propName: keyof PostNode) => (rootNode: FileNode, value: string) => PostNode | undefined; export declare const getPostBySlug: (rootNode: FileNode, value: string) => PostNode | undefined; export declare const getPostByPath: (rootNode: FileNode, value: string) => PostNode | undefined; export declare const getPostsByCategories: (rootNode: FileNode, categories: string[]) => PostNode[]; export declare const getPostsByTags: (rootNode: FileNode, tags: string[]) => PostNode[]; export declare const getPostsByPage: (postList: PostNode[], page: number, perPage?: number) => PostNode[]; export declare const getTotalPage: (total: number, perPage: number) => number; export declare const isPageSlug: (slug: string[]) => boolean; export declare const trimPagePath: (slug: string[]) => string[]; export declare const getPageNum: (slug: string[]) => number; export declare const pagePathFilter: (pathList: Path[], slug: string) => string[][]; export declare const makeHash: (content: string, encoding?: crypto.HexBase64Latin1Encoding) => string; export declare const makeSetLike: <T>(arr: T[]) => T[]; export declare const isDirPath: (path: string) => boolean; export declare const isSubDir: (parent: string, child: string, includeSelf?: boolean) => boolean; export declare const debounce: (fn: (...args: any) => any, time?: number) => (...args: any) => void; export declare const fillToOwnProperty: <R, T>(obj: R, value: T) => R; export declare const normalizeFilePath: (postDir: string, filePath: string) => string; export declare const sortRule: (a: PostNode, b: PostNode) => number;