GithubHelp home page GithubHelp logo

ember-cli-string-utils's Introduction

ember-cli-string-utils

Library for string utils extracted for other addons and blueprints.

Installation

$ npm i ember-cli-string-utils

Code Example

How to use in project :

var stringUtils = require("ember-cli-string-utils");

stringUtils.camelize('action_name');	   // 'actionName'
stringUtils.camelize('css-class-name');    // 'cssClassName'
stringUtils.camelize('my favorite items'); // 'myFavoriteItems'
stringUtils.camelize('My Favorite Items'); // 'myFavoriteItems'

Usage

1) decamelize:

Converts a camelized string into all lowercase separated by underscores.

  decamelize('innerHTML');         // 'inner_html'
  decamelize('action_name');       // 'action_name'
  decamelize('css-class-name');    // 'css-class-name'
  decamelize('my favorite items'); // 'my favorite items'

2) dasherize:

Replaces underscores, spaces, or camelCase with dashes.

  dasherize('innerHTML');         // 'inner-html'
  dasherize('action_name');       // 'action-name'
  dasherize('css-class-name');    // 'css-class-name'
  dasherize('my favorite items'); // 'my-favorite-items'

3) camelize:

Returns the lowerCamelCase form of a string.

  camelize('innerHTML');          // 'innerHTML'
  camelize('action_name');        // 'actionName'
  camelize('css-class-name');     // 'cssClassName'
  camelize('my favorite items');  // 'myFavoriteItems'
  camelize('My Favorite Items');  // 'myFavoriteItems'

4) classify:

Returns the UpperCamelCase form of a string.

  'innerHTML'.classify();          // 'InnerHTML'
  'action_name'.classify();        // 'ActionName'
  'css-class-name'.classify();     // 'CssClassName'
  'my favorite items'.classify();  // 'MyFavoriteItems'

5) underscore:

More general than decamelize. Returns the lower_case_and_underscored form of a string.

  'innerHTML'.underscore();          // 'inner_html'
  'action_name'.underscore();        // 'action_name'
  'css-class-name'.underscore();     // 'css_class_name'
  'my favorite items'.underscore();  // 'my_favorite_items'

6) capitalize:

Returns the Capitalized form of a string.

  'innerHTML'.capitalize()         // 'InnerHTML'
  'action_name'.capitalize()       // 'Action_name'
  'css-class-name'.capitalize()    // 'Css-class-name'
  'my favorite items'.capitalize() // 'My favorite items'

Author

ember-cli contributors

License

ISC

ember-cli-string-utils's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar greenkeeperio-bot avatar qaseemlodhi avatar rwjblue avatar stefanpenner avatar turbo87 avatar warmans avatar

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.