Skip to content

Home > fff-flavored-frontmatter > transform

transform variable

Flavor Transform Function

Signature:

typescript
transform: <TInput extends Record<string, unknown> = Record<string, unknown>, TOutput extends TInput = FFFBase<undefined> & FFFDateTime & FFFMedia<undefined> & FFFMention & FFFExtra<undefined> & TInput>(fm: TInput, presets: FFFTransformPreset[]) => TOutput

Example

ts
import { transform } from 'fff-flavored-frontmatter'

const fm = transform({
  date: '2022-07-18',
  lastmod: '2023-06-04',
}, [{
  created: 'date',
  updated: 'lastmod',
}])

// { created: '2022-07-18', date: '2022-07-18', lastmod: '2023-06-04', updated: '2023-06-04' }
console.log(fm)