enhance

ac-apps-minimal-enhance-string

enhance/string.js

Converts strings to camelcase or propercase.

Example:
app.camelCase("this line should be camel case.")
app.properCase("this line should be proper case.")

A module for ac-bundle-app, published by ac-bundle-module.

Install from:

https://www.npmjs.com/package/ac-apps-minimal-enhance-string
https://github.com/animatedcreativity/ac-apps-minimal-enhance-string

Available Methods: start

start

function() {
  app.camelCase = function camelize(str, capitalFirst) {
    if (!app.has(capitalFirst)) capitalFirst = false;
    var result = str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
      return index === 0 ? word.toLowerCase() : word.toUpperCase();
    }).replace(/\s+/g, '');
    if (capitalFirst) result = result.substr(0, 1).toUpperCase() + result.substr(1, 999);
    return result;
  };
  app.properCase = function(str) {
    return str.replace(
      /\w\S*/g,
      function(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }
    );
  };
}

Happy Coding!

MIT License: https://choosealicense.com/licenses/mit/

Copyright 2022 Animated Creativity

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Leave a Reply

Your email address will not be published. Required fields are marked *