Comments (5)
Looking into it... It appears my regex's are not diacritic savvy. This may take a little time. I'll look into it, if no one beats me too it.
from case.
I searched for 10 minutes and looks like js' regex and Unicode sux... big time. You can see on Stack Overflow results all sorts of magic stuff; not really that classy.
Looks like that the least hackish way to accomplish this is to rely on an external library to do the job, such as xregexp. But that would mean adding it as a dependency and replacing js' RegExp calls...
from case.
Blech. Case is too small for dependencies. There may be simpler ways. Not giving up on this yet. :)
from case.
Ok, i think i can pretty easily support at least this much unicode: http://www.utf8-chartable.de/ That'll give us common diacritics, as well as a better range of symbols that can be "filled".
Pressing on to the second page gets more difficult, as the smalls and capitals begin to alternate both rapidly and inconsistently. http://www.utf8-chartable.de/unicode-utf8-table.pl?start=256 Pressing on beyond latin into greek shows little end to the challenge.
Eventually, i'd like to make Case's regexps officially extensible so that it's not too hard for people to create things like a Case.greek.js extension.
from case.
Ok, so you can now easily extend/replace the regexp set like so:
Case._.re = Case._.regexps([symbols][, lowers, uppers][, impropers]);
The four parameters are the logical expressions needed to make all the different transformations supported out of the box by Case. The first three should be strings that will go inside regexp character sets (e.g. new RegExp('['+symbols+']', 'g')
). The impropers
should be a regexp string that matches words that shouldn't be capitalized in title case (e.g. 'A|An|The'
and so on). If any are missing, they will be filled in with the default ones.
Also, the symbols regexps are no longer exclusive but inclusive, meaning that you will never see the disappearing letter problem again.
from case.
Related Issues (20)
- How to handle ignore cases HOT 2
- 1.2.0 is a broken release HOT 15
- First and last word in title should always be capitalized HOT 5
- Case.of('foo') is 'snake'
- Title bugs HOT 6
- Solitary word with a `-` in it is mangled by title case HOT 1
- Please add jsdoc for public interface HOT 7
- Add acronym support HOT 1
- Passing in empty string to sentence function causes error HOT 2
- MIT, GPL Viral License? HOT 2
- Sentence case can contain capitalization HOT 3
- can't require as commonjs module in node? HOT 1
- Case.of('123'); results as "lowercase" HOT 3
- Constant case not working HOT 1
- License field on npm showing "none" due to inappropriate LICENSE file name HOT 3
- String with bracket issue HOT 1
- Publish license information with NPM
- export mjs for esm HOT 20
- `Case.of(Case.pascal(string)) === "capital"`
- License: Case is published on NPM under different licenses as stated in this repo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from case.