UNPKG

note

Version:
57 lines (55 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeFilename = exports.makeContent = void 0; var _Slug = require("@effect-native/schemas/Slug"); /** * Core note creation logic. * * @since 0.1.0 */ /** * Generates the note filename from title and date. * * Format: `note-YYYY-MM-DD-<slug>.md` * * @example * import { makeFilename } from "note/Note" * * const date = new Date("2025-11-26T14:30:56.886Z") * makeFilename("Hello World", date) // "note-2025-11-26-hello-world.md" * * @since 0.1.0 * @category Note */ const makeFilename = (title, date) => { const dateStr = date.toISOString().slice(0, 10); const slug = (0, _Slug.slugify)(title); return `note-${dateStr}-${slug}.md`; }; /** * Generates the note markdown content. * * Format: * ``` * # <title> * * Created: <ISO-8601-timestamp> * ``` * * @example * import { makeContent } from "note/Note" * * const timestamp = new Date("2025-11-26T14:30:56.886Z") * makeContent("My Note Title", timestamp) * // Returns: * // "# My Note Title\n\nCreated: 2025-11-26T14:30:56.886Z\n" * * @since 0.1.0 * @category Note */ exports.makeFilename = makeFilename; const makeContent = (title, timestamp) => `# ${title}\n\nCreated: ${timestamp.toISOString()}\n`; exports.makeContent = makeContent; //# sourceMappingURL=Note.js.map