Coder Social home page Coder Social logo

Comments (6)

inukshuk avatar inukshuk commented on May 27, 2024

Hm, that's something we'd have to look at in more detail. I think assertions are sometimes used to throw meaningful error messages, so I'd probably look into replacing them with a built-in function (either outright or via rollup replace plugin) instead of just removing them.

from edtf.js.

tarjelavik avatar tarjelavik commented on May 27, 2024

Yeah, i guess there is more to it :-). I am not an expert, but it seems to me that assert is mostly used in tests? There is also the isomorphic-assert library, if that helps.

I really appreciate your work on EDTF for javascript, but i have used the forks that has done changes for running in the browser. I would rather use your library of course :-).

from edtf.js.

inukshuk avatar inukshuk commented on May 27, 2024

Is assert the only obstacle to having the parser run in the browser?

from edtf.js.

tarjelavik avatar tarjelavik commented on May 27, 2024

Mmm, by testing your package vs uf0's repo it seemed like it. As far as i know assert is Node only....

from edtf.js.

inukshuk avatar inukshuk commented on May 27, 2024

OK I pushed 4.5.0 4.5.1 which uses a custom assert instead of the Node.js module. With this the ESM and CJS modules only import/require internal modules and the nearley package (which should work in the browser); the separate sample module entry point will also import randexp (I don't know if that one works in the browser).

Essentially, this means you should be able to use the main ESM entry point 'as is' in a browser, but you'll have to bundle everything (e.g. using rollup) of course.

from edtf.js.

tarjelavik avatar tarjelavik commented on May 27, 2024

Thx! I got it working, but yeah, bundling and all that is not my favorite topics. Had to work around that my plugins in turn is bundled into another app.
I'll revisit this later, but it works for now :-)

from edtf.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.