feat: # to import doc

This commit is contained in:
Timothy J. Baek committed 2024-01-07 23:43:32 -08:00
1 parent 2603ac30bc
commit cc3f84f916
11 files changed
+894 -32

No files matched your search

+18
View File
@@ -128,6 +128,24 @@ export const findWordIndices = (text) => {
return matches;
};
export const removeFirstHashWord = (inputString) => {
// Split the string into an array of words
const words = inputString.split(' ');
// Find the index of the first word that starts with #
const index = words.findIndex((word) => word.startsWith('#'));
// Remove the first word with #
if (index !== -1) {
words.splice(index, 1);
}
// Join the remaining words back into a string
const resultString = words.join(' ');
return resultString;
};
export const calculateSHA256 = async (file) => {
// Create a FileReader to read the file asynchronously
const reader = new FileReader();