Giter Club home page Giter Club logo

Comments (7)

Michael-F-Ellis avatar Michael-F-Ellis commented on May 18, 2024 1

The following works for my immediate problem but it makes my skin crawl a little.

                while a.startswith('-'):
                    a = a[1:]
                while a.endswith('-'):
                    a = a[:-1]

from transcrypt.

JdeH avatar JdeH commented on May 18, 2024

Indeed this was not yet done to keep the libraries as small as possible. Tried to cover the most common usage first. Probably will supply a more extensive lib in a later version.

from transcrypt.

Michael-F-Ellis avatar Michael-F-Ellis commented on May 18, 2024

Can we reopen this one? I very much need a strip() that does more than trim whitespace. If not, can you suggest a workaround that will do the right thing in both Cpython and Transcrypt?
Thanks!

from transcrypt.

mmjee avatar mmjee commented on May 18, 2024

Implementing this should be very easy, it's worth implementing.

from transcrypt.

mmjee avatar mmjee commented on May 18, 2024

I suggest we reopen this, too.

from transcrypt.

fzzylogic avatar fzzylogic commented on May 18, 2024

Don't think Javascript has anything that does that natively, so if Transcrypt did do so, it would probably compile to something like what you suggested, despite the discomfort that would induce :-). For example. The regex based suggested polyfill for native trim() at MDN is also interesting. Please mention what you settle on, could be useful. Perhaps one day one could have ones cake and eat it by having modules that provide closer cpython support at the cost of size / speed, thereby saving the core from bloat but providing the option to those that can live with that.

from transcrypt.

Michael-F-Ellis avatar Michael-F-Ellis commented on May 18, 2024

@fzzylogic Good point! I think there are a couple of meta-issues here so I'm going to submit those separately to promote wider discussion.

from transcrypt.

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.