Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createNavigationChapterInformationForExamples(authorName, word, isStandalone) {
const navigationChapter = new NavigationChapter(new ExamplesSource(
authorName,
word,
isStandalone,
));
return new NavigationChapterInformation(navigationChapter);
}
function createNavigationChapterInformationForKanji(authorName, word, isStandalone, prefix) {
const kanjis = removeDuplicates(word.match(KANJI_REGEX));
const pageCount = kanjis ? kanjis.length : 0;
const hasMultiplePages = pageCount > 1;
const hasAnyPages = pageCount > 0;
let navigationChapter;
if (kanjis && kanjis.length > 0) {
navigationChapter = new NavigationChapter(new KanjiDataSource(
authorName,
kanjis,
isStandalone,
hasMultiplePages,
prefix,
));
} else if (isStandalone) {
navigationChapter = new NavigationChapter(new KanjiDataSource(
authorName,
word,
isStandalone,
hasMultiplePages,
prefix,
));
}
function createFoundResult(msg, pronounceInfo, navigationManager, logger) {
const navigationDataSource = new PronunciationDataSource(
msg.author.username,
pronounceInfo,
logger,
);
const navigationChapter = new NavigationChapter(navigationDataSource);
const chapterForEmojiName = { a: navigationChapter };
const hasMultiplePages = pronounceInfo.entries.length > 1;
const authorId = msg.author.id;
const navigation = new Navigation(authorId, hasMultiplePages, 'a', chapterForEmojiName);
return navigationManager.show(navigation, constants.NAVIGATION_EXPIRATION_TIME, msg.channel, msg);
}
function createFoundResult(msg, pronounceInfo, navigationManager, logger) {
const navigationDataSource = new PronunciationDataSource(
msg.author.username,
pronounceInfo,
logger,
);
const navigationChapter = new NavigationChapter(navigationDataSource);
const chapterForEmojiName = { a: navigationChapter };
const hasMultiplePages = pronounceInfo.entries.length > 1;
const authorId = msg.author.id;
const navigation = new Navigation(authorId, hasMultiplePages, 'a', chapterForEmojiName);
return navigationManager.show(navigation, constants.NAVIGATION_EXPIRATION_TIME, msg.channel, msg);
}
function createNavigationChapterInformationForStrokeOrder(authorName, word, isStandalone) {
const kanjis = removeDuplicates(word.match(KANJI_REGEX));
const pageCount = kanjis ? kanjis.length : 0;
const hasMultiplePages = pageCount > 1;
const hasAnyPages = pageCount > 0;
let navigationChapter;
if (kanjis && kanjis.length > 0) {
navigationChapter = new NavigationChapter(new StrokeOrderDataSource(
authorName,
kanjis,
isStandalone,
hasMultiplePages,
));
} else if (isStandalone) {
navigationChapter = new NavigationChapter(new StrokeOrderDataSource(
authorName,
word,
isStandalone,
hasMultiplePages,
));
}
return new NavigationChapterInformation(navigationChapter, hasMultiplePages, hasAnyPages);
}
const kanjis = removeDuplicates(word.match(KANJI_REGEX));
const pageCount = kanjis ? kanjis.length : 0;
const hasMultiplePages = pageCount > 1;
const hasAnyPages = pageCount > 0;
let navigationChapter;
if (kanjis && kanjis.length > 0) {
navigationChapter = new NavigationChapter(new KanjiDataSource(
authorName,
kanjis,
isStandalone,
hasMultiplePages,
prefix,
));
} else if (isStandalone) {
navigationChapter = new NavigationChapter(new KanjiDataSource(
authorName,
word,
isStandalone,
hasMultiplePages,
prefix,
));
}
return new NavigationChapterInformation(navigationChapter, hasMultiplePages, hasAnyPages);
}