Skip to content

Commit 6705889

Browse files
committed
Refactor sync module to load constants from constants module
1 parent 1f43748 commit 6705889

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

sync/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ const Lock = require('./lock');
44
const SnippetPublisher = require('./publishers/snippet-publisher');
55
const MarkdownPublisher = require('./publishers/markdown-publisher');
66

7-
const NOTE_TYPES = {
8-
MARKDOWN_NOTE: 'MARKDOWN_NOTE',
9-
SNIPPET_NOTE: 'SNIPPET_NOTE'
10-
};
11-
127
module.exports = class Sync {
138
/**
149
* Construct Sync Module
@@ -89,12 +84,12 @@ module.exports = class Sync {
8984
*/
9085
async syncParsedMarkdown({ file, raw, type }) {
9186
const { title, content } = raw;
92-
if (type === NOTE_TYPES.MARKDOWN_NOTE) {
87+
if (type === this.constants.fileTypes.MARKDOWN_NOTE) {
9388
await this.markdownPublisher.publish({ file, title, content });
9489
this.logger.info(`Content of ${file} synced as a parsed markdown note`);
9590
}
9691

97-
if (type === NOTE_TYPES.SNIPPET_NOTE) {
92+
if (type === this.constants.fileTypes.SNIPPET_NOTE) {
9893
await this.snippetPublisher.publish({ file, title, content });
9994
this.logger.info(`Content of ${file} synced as a parsed snippet note`);
10095
}
@@ -117,8 +112,8 @@ module.exports = class Sync {
117112

118113
if (event === this.constants.events.FILE_CREATE_OR_UPDATE) {
119114
const isParsableContent = [
120-
NOTE_TYPES.MARKDOWN_NOTE,
121-
NOTE_TYPES.SNIPPET_NOTE
115+
this.constants.fileTypes.MARKDOWN_NOTE,
116+
this.constants.fileTypes.SNIPPET_NOTE
122117
].includes(type);
123118

124119
if (this.config.modes.raw) {

0 commit comments

Comments
 (0)