Skip to content

Commit

Permalink
feat: reafctor transformPost interface (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG authored Feb 26, 2024
1 parent d854d98 commit a287638
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/data/transformPost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import {typografToHTML, typografToText, yfmTransformer} from '@gravity-ui/page-c
import {PostData, TransformPostOptions} from '../models/common';
import {Lang} from '../models/locale';

export type TransformPostType = {
postData: PostData;
lang: Lang;
options: TransformPostOptions;
};

/**
* Func for transform post data
*
Expand All @@ -12,11 +18,7 @@ import {Lang} from '../models/locale';
* @param plugins - YFM plugins list
* @returns -prepared post
*/
export const transformPost = (
postData: PostData,
lang: Lang,
{plugins}: TransformPostOptions = {},
) => {
export const transformPost = ({postData, lang, options: {plugins} = {}}: TransformPostType) => {
if (!postData) {
// eslint-disable-next-line no-console
console.error('Post not found');
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {transformPageContent} from './data/transformPageContent';
export {createReadableContent} from './data/createReadableContent';
export {sanitizeMeta} from './data/sanitizeMeta';
export {transformPost} from './data/transformPost';
export {transformPost, TransformPostType} from './data/transformPost';

0 comments on commit a287638

Please sign in to comment.