Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiling #9

Open
murtyjones opened this issue Aug 25, 2018 · 8 comments
Open

Transpiling #9

murtyjones opened this issue Aug 25, 2018 · 8 comments

Comments

@murtyjones
Copy link

Nice library.

FYI, its usage in browsers is hampered by the fact that there are some things needed transpile in older browser (let was the main thing I noticed).

I got around it by manually specifying transpiling in my webpack config, but you might consider adding some transpiling at the module level.

@boutell
Copy link
Member

boutell commented Aug 27, 2018

A reasonable idea, but since we don't use this in the browser, not something that I'll have the time for in-house. I've given the issue the "contribution welcome" label.

@murtyjones
Copy link
Author

alternatively, changing the following two lines

    let rightSize = false;
    let wordUsed;

to:

    var rightSize = false;
    var wordUsed;

appears to obviate the need for transpilation.

@boutell
Copy link
Member

boutell commented Aug 28, 2018 via email

@CrlH
Copy link
Contributor

CrlH commented Oct 2, 2018

@murtyjones Took the liberty to do a full ES6 rewrite, added Babel while at it. Can you check this branch does the trick?

@boutell
Copy link
Member

boutell commented Oct 3, 2018 via email

@murtyjones
Copy link
Author

I've forked this library so I'm going to go ahead and unsubscribe from this issue, after noting the following:

  1. This library is about 90 lines of code.
  2. 87 of these lines appear to be ES5
  3. three of thee lines appear to be ES6:
    let rightSize = false;
    let wordUsed;
...
    options.formatter = (word) => word;
  1. These three lines could be converted to ES5 like so:
    var rightSize = false;
    var wordUsed;
...
    options.formatter = function (word) { return word; };

@CrlH
Copy link
Contributor

CrlH commented Oct 3, 2018

@murtyjones Indeed, but since it can be used in non-browser environment, I rewrote to ES6 anyway, transpiling it. Overkill maybe, I just liked the idea. :-)

Regarding the code:

  • The rewrite is the src folder, dist is built by Babel
  • I’ve moved some functions because there’s no need to expose/export them
  • AirBNB ESLint config is indeed maintained by AirBNB, but well respected as a code styling guideline.

@boutell
Copy link
Member

boutell commented Oct 3, 2018

Use of the airbnb config is fine as long as it's something that the dependencies are enough to install/discover/whatever; that's what I'm asking about.

I was looking in the wrong place, yes. Still not sure why using "const" for functions and thus requiring them to come before the higher-level functions that call them is an improvement, though.

Fork it if you want I guess (not that I can stop you (: )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants