We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, the FFF preset looks like this:
import type { FFFTransformPreset } from 'fff-flavored-frontmatter' // input: // date: 2023-02-23 // output: // date: 2023-02-23 // created: 2023-02-23 const basic: FFFTransformPreset = { created: 'date', }
However, it would be nice to be able to rename/remove keys:
type FFFPreset<T extends Record<string, unknown> = Record<string, unknown>> = (fm: FFFFlavoredFrontmatter & T) => FFFFlavoredFrontmatter & T
The new preset will provide and accept the full Frontmatter.
Then you can do this:
const rename = (obj: Record<string, string>): FFFPreset => (fm) => Object.fromEntries( Object.entries(fm) .map(([key, value]) => Object.keys(obj).includes(key) ? (Object.keys(fm).includes(obj[key]) ? [undefined, undefined] : [obj[key], value]) : [key, value], ), ) const remove = (arr: string[]): FFFPreset => (fm) => Object.fromEntries( Object.entries(fm) .filter(([key]) => arr.includes(key)) ) )
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, the FFF preset looks like this:
However, it would be nice to be able to rename/remove keys:
The new preset will provide and accept the full Frontmatter.
Then you can do this:
The text was updated successfully, but these errors were encountered: