Code Monkey home page Code Monkey logo

Comments (10)

cscott avatar cscott commented on May 17, 2024 1

The Unicode databases required are rather large; perhaps this should be an optional dependency? That is, something like:

String.prototype.normalize = function(form) { return require('unorm')[String(form).toLowerCase()](this); }

with the appropriate error handling and helpful messages if require('unorm') fails.

from es6-shim.

Yaffle avatar Yaffle commented on May 17, 2024

String.prototype.normalize = function(){return String(this);}

from es6-shim.

ljharb avatar ljharb commented on May 17, 2024

Unfortunately it's far more complex than that. The spec says that it takes a "form" argument that defaults to "NFC", and it throws a RangeError if String(form) is not "NFC", "NFD", "NFKC", or "NFKD" - then it uses the Unicode Normalization Algorithm for the specified form.

from es6-shim.

mathiasbynens avatar mathiasbynens commented on May 17, 2024

http://git.io/unorm

from es6-shim.

ljharb avatar ljharb commented on May 17, 2024

https://github.com/walling/unorm/blob/master/lib/unorm.js doesn't seem that large… While that's a valid concern, I think having a single es6-shim.js file that shims as much as it can is very important to the purpose of the shim.

As for a require, that'd be nice, but we'd need to ensure the shim still works with all the module systems it currently has - it might be better to copy/paste it in, like I did with the Math.fround/numberConversion stuff.

from es6-shim.

cscott avatar cscott commented on May 17, 2024

https://github.com/walling/unorm/blob/master/lib/unorm.js is 141kB. That's the standalone version of the library (it appears to combine unorm.js with https://github.com/walling/unorm/blob/master/src/unormdata.js, which is 122kB).

For comparison, unminimized es6-shim.js is currently 42kB. So this would be a 435% increase in the size of es6-shim -- probably a larger increase if you look at the minimized sizes. I think that's large enough that people would avoid using es6-shim for mobile projects.

from es6-shim.

ljharb avatar ljharb commented on May 17, 2024

Fair point. If we want to point people at https://github.com/walling/unorm, then we need to make it very clear in the documentation.

from es6-shim.

paulmillr avatar paulmillr commented on May 17, 2024

yup totally agree, including ultra-big shims with the lib is not good

at least until we will have custom builds

from es6-shim.

cscott avatar cscott commented on May 17, 2024

I added a pointer to unorm in the documentation (see c185084 and a04221b).

from es6-shim.

ljharb avatar ljharb commented on May 17, 2024

Closing this for now - when/if #136 happens, we will include String#normalize as an includable option.

from es6-shim.

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.