Skip to content

Undefined Exception? #6

@AddoSolutions

Description

@AddoSolutions

Looks like you had an issue here:

/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/html2markdown.js:44
    return value.replace(/^\s+|\s+$/g,"");
                 ^
TypeError: Cannot call method 'replace' of undefined
    at trim (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/html2markdown.js:44:15)
    at Object.parser.end (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/html2markdown.js:377:34)
    at parseEndTag (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/markdown_html_parser.js:198:15)
    at String.replace (native)
    at HTMLParser (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/markdown_html_parser.js:99:16)
    at html2markdown (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/html2markdown.js:197:2)
    at module.exports (/Users/Nitrx/Desktop/enml2md/node_modules/html2markdown/index.js:7:10)
    at Note.loadENMLContent (/Users/Nitrx/Desktop/enml2md/lib/Note.js:71:29)
    at Function.Note.composeNoteWithCheerio (/Users/Nitrx/Desktop/enml2md/lib/Note.js:103:10)
    at null.<anonymous> (/Users/Nitrx/Desktop/enml2md/lib/Parser.js:28:23)
Nitrx@Davids-MacBook-Pro:~/Desktop/enml2md (master)$ node bin/enml2md ../EverNotes/MyNotes.enex ../EverNotes/Out

I patched it by replacing:

function trim(value) {
    return value.replace(/^\s+|\s+$/g,"");
}

with

function trim(value) {
    if(!value) return "";
    return value.replace(/^\s+|\s+$/g,"");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions