finnfiddle / words-to-numbers

JS library to convert textual words to numbers with optional fuzzy text matching
MIT License
248 stars 57 forks source link

Uncaught TypeError in Typescript #43

Open DestinyIJ opened 1 year ago

DestinyIJ commented 1 year ago

clj-fuzzy.js:2 Uncaught TypeError: Cannot use 'in' operator to search for 'clj_fuzzy' in undefined Capture

stevenschemers commented 1 year ago

Same thing happening to me when using Vite

Aivean commented 1 year ago

Repro:

     const moduleUrl = 'https://cdn.jsdelivr.net/npm/words-to-numbers@1.5.1/+esm';

    try {
        const wordsToNumbersModule = await import(moduleUrl);
        console.log(wordsToNumbersModule.default('one hundred'));  // Should output 100
    } catch (error) {
        console.error('Failed to load module:', error);
    }

https://jsfiddle.net/6vxg5ae0/

csp197 commented 12 months ago

Can confirm... I ran into the same issue using this library for a React app.

I suspect the error refers to the clj-fuzzy library, which has been deprecated, for the talisman library.

I made the necessary changes in my PR :)

pmalacho-mit commented 10 months ago

Awesome, thanks @CSP197 !! When do you think your PR will be incorporated into a new version now that it's approved? I'm facing this same issue right now with a rollup bundle

csp197 commented 10 months ago

Hi @pmalacho-mit, I don't have write access to this repo, so I believe only the repo maintainer, @finnfiddle, can merge this PR.