Skip to content

Commit

Permalink
fix(TagNote): 🐛 Null-check on tags coming in
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 10, 2022
1 parent bf4b4bd commit 6da0b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22475,7 +22475,7 @@ const getFolder = (file) => { var _a;
//@ts-ignore
return ((_a = file === null || file === void 0 ? void 0 : file.parent) === null || _a === void 0 ? void 0 : _a.name) || file.folder; };
const splitAndTrim = (fields) => {
if (fields === "")
if (!fields || fields === "")
return [];
else
return fields.split(",").map((str) => str.trim());
Expand Down
4 changes: 3 additions & 1 deletion src/sharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const getFolder = (file: TFile): string =>
file?.parent?.name || file.folder;

export const splitAndTrim = (fields: string): string[] => {
if (fields === "") return [];
if (!fields || fields === "") return [];
else return fields.split(",").map((str) => str.trim());
};

Expand Down Expand Up @@ -323,6 +323,8 @@ export function strToRegex(input: string) {
export const dropHash = (tag: string) =>
tag.startsWith("#") ? tag.slice(1) : tag;

export const addHash = (tag: string) => (tag.startsWith("#") ? tag : `#${tag}`);

export function getAlt(node: string, plugin: BCPlugin): string | null {
const { app } = plugin;
const { altLinkFields, showAllAliases } = plugin.settings;
Expand Down

0 comments on commit 6da0b7e

Please sign in to comment.