UNPKG

yarle-evernote-to-md

Version:

Yet Another Rope Ladder from Evernote

64 lines (57 loc) 3.06 kB
import * as CREATIONTIME from './placeholders/createdat-placeholders'; importas LOCATION from './placeholders/location-placeholders'; importas NOTEBOOK from './placeholders/notebook-placeholders'; import * as ORIGINALLINK from './placeholders/original-placeholders'; import * as SOURCEURL from './placeholders/sourceurl-placeholders'; importas TAGS from './placeholders/tags-placeholders'; import * as YAMLARRAYTAGS from './placeholders/tags-array-placeholders'; import * as YAMLLISTTAGS from './placeholders/tags-yaml-list-placeholders'; import * as METADATA from './placeholders/metadata-placeholders'; import * as UPDATETIME from './placeholders/updatedat-placeholders'; importas REMINDERTIME from './placeholders/remindertime-placeholders'; importas REMINDERDONETIME from './placeholders/reminderdonetime-placeholders'; importas REMINDERORDER from './placeholders/reminderorder-placeholders'; export const hasCreationTimeInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(CREATIONTIME, templateContent); }; export const hasReminderTimeInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(REMINDERTIME, templateContent); }; export const hasReminderDoneTimeInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(REMINDERDONETIME, templateContent); }; export const hasReminderOrderInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(REMINDERORDER, templateContent); }; export const hasLocationInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(LOCATION, templateContent); }; export const hasNotebookInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(NOTEBOOK, templateContent); }; export const hasOriginalLinkInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(ORIGINALLINK, templateContent); }; export const hasSourceURLInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(SOURCEURL, templateContent); }; export const hasAnyTagsInTemplate = (templateContent: string): boolean => { return (hasItemInTemplate(TAGS, templateContent) || hasItemInTemplate(YAMLARRAYTAGS, templateContent) || hasItemInTemplate(YAMLLISTTAGS, templateContent)); }; export const hasMetadataInTemplate = (templateContent: string): boolean => { return templateContent.includes(METADATA.START_BLOCK) && templateContent.includes(METADATA.END_BLOCK); }; export const hasUpdateTimeInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(UPDATETIME, templateContent); }; export const hasLinkToOriginalInTemplate = (templateContent: string): boolean => { return hasItemInTemplate(ORIGINALLINK, templateContent); }; const hasItemInTemplate = (item: any, templateContent: string): boolean => { return templateContent.includes(item.START_BLOCK) && templateContent.includes(item.CONTENT_PLACEHOLDER) && templateContent.includes(item.END_BLOCK); };