UNPKG

@nolebase/vitepress-plugin-page-properties

Version:

A VitePress plugin that renders frontmatter as page properties, and makes them editable.

44 lines (43 loc) 1.43 kB
export function isTagsProperty(value, property) { return value && typeof value === "object" && property && property.type && property.type === "tags"; } export function isPlainProperty(_, property) { if (property && property.type && property.type === "plain") return true; return false; } export function isDatetimeProperty(value, property) { try { const date = new Date(value); if (date.toString() === "Invalid Date") return false; } catch { return false; } if (property && property.type && property.type === "datetime") return true; return false; } export function isProgressProperty(value, property) { const parsedValue = Number.parseFloat(value); if (Number.isNaN(parsedValue)) return false; if (property && property.type && property.type === "progress") return true; return false; } export function isLinkProperty(_, property) { if (property && property.type && property.type === "link") return true; return false; } export function isDynamicWordsCountProperty(_, property) { if (property && property.type && property.type === "dynamic" && property.options && property.options.type === "wordsCount") return true; return false; } export function isDynamicReadingTimeProperty(_, property) { if (property && property.type && property.type === "dynamic" && property.options && property.options.type === "readingTime") return true; return false; }