Coder Social home page Coder Social logo

nbubna / case Goto Github PK

View Code? Open in Web Editor NEW
279.0 279.0 26.0 492 KB

String case utitility: convert, identify, flip, extend

Home Page: http://nbubna.github.io/Case/

License: MIT License

JavaScript 93.40% CSS 5.83% HTML 0.77%
camelcase capital case constants dot javascript kebab-case letters lowercase pascal sentence snake string title type uppercase

case's People

Contributors

aymannedaa avatar bitdeli-chef avatar bluelovers avatar dependabot[bot] avatar evanshortiss avatar ianstormtaylor avatar jasonkuhrt avatar nbubna avatar nemrow avatar shroudedcode avatar tomsawkins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

case's Issues

Sentence case can contain capitalization

As well as the first letter, sentence case strings can contain capital letters in cases such as proper nouns and acronyms.

For example, this title should be identified as sentence case: "Skin microbiota in frogs from the Brazilian Atlantic Forest: species, forest type, and potential against pathogens".

`Case.of(Case.pascal(string)) === "capital"`

I just stumbled upon this issue:

If I have a string like "Room", Case.of() returns capital.
If I turn it into a pascal string (which it already is) and then get the case of that Case.of(Case.pascal('Room'), it still returns capital.

I think there is some kind of configuration needed on how to handle single word strings, because those are ambiguous. I could propose a PR if you like.

String with bracket issue

Hi,

Strange behavior when (No) is there in string.
E.G.

title("ABC (No)") // ABC (No) 
title("ABC (NO)") // Abc (No)  
title("ABC (NT)") // Abc (Nt)
title("ABC (XX)") // Abc (Xx)

Same with capital, I haven't checked other.
Hope to resolve soon.

How to handle ignore cases

Lets say I have something formatted from numeral.js.

var m = 1.40m;
m = case.upper(m)
console.log(m) //will yield 1 40M , how do I ignore the period remeoval?

Also yes I know I could use the last char.upper() , that is besides the point.

MIT, GPL Viral License?

In doing a license audit, Case reports both MIT and GPL.

Anything that includes or links to GPL inherits GPL terms, therefore making the entire Case package viral. You also list MIT which is non-viral, but the GPL virally overrides the MIT terms.

Do you intend for Case to be GPL (viral), or MIT? Or, is Case subject to a sub-component / code snippet that carries GPL?

Files in Case Referencing GPL

1.1.0 is broken on Node.js

$ npm install case
[email protected] node_modules/case
$ node
> require('case')
ReferenceError: window is not defined
    at Object.<anonymous> (/home/ubuntu/playground/node_modules/case/dist/Case.js:125:18)
    at Object.<anonymous> (/home/ubuntu/playground/node_modules/case/dist/Case.js:128:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)

I guess the problem lies on these 2 lines.

Passing in empty string to sentence function causes error

Hi,

Passing in an empty string into the sentenceCase filter generates an error "Unable to get property 'replace' of undefined or null reference".

After stepping thru the code, I believe the culprit is the modifications to the fill functions at this commit 3289456#diff-6f9cd8468dcb32af7249d8e02dd3ab07.

Previously, you would return 's' if !s === true, however in the latest you do not return anything, causing it to return undefined.

-Taylor

component name

in node require('case') works.
in the browser require('case') doesn't, you gotta do require('Case') for it to work.

Edited typo

Title bugs

Title turns I'm into I'M.

Also it will turn -30 into 30.
Oddly enough it works fine if there is another word such as -30 degrees

Constant case not working

Thanks for this great library! However, this is the first time I have run into a case were something was not as expected.

See the below:

const changeCase = require('change-case');
const Case = require('case');

console.log(Case.constant('crapP4')) // ===> 'CRAPP4'
console.log(changeCase.constant('crapP4')) // ===> 'CRAP_P4'

I believe changeCase is correct.

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.