Skip to content

Commit

Permalink
fix: error when value is null
Browse files Browse the repository at this point in the history
Add '==' check for null for value.

Fixes #36
Closes #39
  • Loading branch information
dabakovich committed Mar 10, 2021
1 parent a3c41ec commit 640edec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ const generateValueWithAddedSuggestion = (
* @param text - plain text that will be added to the part
* @param positionOffset - position offset from the very beginning of text
*/
const generatePlainTextPart = (text: string = '', positionOffset = 0): Part => ({
const generatePlainTextPart = (text: string, positionOffset = 0): Part => ({
text,
position: {
start: positionOffset,
Expand Down Expand Up @@ -369,10 +369,13 @@ const getMentionDataFromRegExMatchResult = ([, original, trigger, name, id]: Reg
* @param positionOffset - offset from the very beginning of plain text
*/
const parseValue = (
value: string = '',
value: string,
partTypes: PartType[],
positionOffset = 0,
): { plainText: string; parts: Part[] } => {
if (value == null) {
value = '';
}

let plainText = '';
let parts: Part[] = [];
Expand Down

0 comments on commit 640edec

Please sign in to comment.