Code Monkey home page Code Monkey logo

ember-cli-string-helpers's Introduction

ember-cli-string-helpers

Download count all time CircleCI npm version Ember Observer Score

String helpers for Ember. Extracted from the great DockYard's ember-composable-helpers.

To install:

ember install ember-cli-string-helpers

Configuration

If you don't need all the helpers, you can specify which to whitelist or blacklist using only or except within your config/environment.js:

module.exports = function(environment) {
  var ENV = {
    'ember-cli-string-helpers': {
      only: ['dasherize', 'underscore'],
      except: ['titleize', 'capitalize']
    }
  };

Both only and except can be safely used together (the addon computes the diff), although it's best if you only use one for your own sanity.

except: ['camelize'] // imports all helpers except `camelize`
only: ['camelize'] // imports only `camelize`

Available helpers

Usage

camelize

Camelizes a string using Ember.String.camelize.

{{camelize "hello jim bob"}}
{{camelize stringWithDashes}}

⬆️ back to top

capitalize

Capitalizes a string using Ember.String.capitalize.

{{capitalize "hello jim bob"}}
{{capitalize fullName}}

⬆️ back to top

classify

Classifies a string using Ember.String.classify.

{{classify "hello jim bob"}}
{{classify stringWithDashes}}

⬆️ back to top

dasherize

Dasherizes a string using Ember.String.dasherize.

{{dasherize "whatsThat"}}
{{dasherize phrase}}

⬆️ back to top

html-safe

Mark a string as safe for unescaped output with Ember templates using Ember.String.htmlSafe.

{{html-safe "<div>someString</div>"}}
{{html-safe unsafeString}}

⬆️ back to top

humanize

Removes dashes and underscores from a string, capitalizes the first letter and makes the rest of the string lower case.

{{humanize "some-string"}}
{{humanize phrase}}

⬆️ back to top

lowercase

Lowercases a string.

{{lowercase "People Person's Paper People"}}
{{lowercase phrase}}

⬆️ back to top

titleize

Capitalizes every word separated by a white space or a dash.

{{titleize "my big fat greek wedding"}}
{{titleize phrase}}

⬆️ back to top

trim

Trim a string.

{{trim "  Lorem ipsum dolor sit amet, consectetur adipiscing elit.   "}}
{{trim phrase}}

truncate

Truncates a string with a characterLimit and optionally adds an ellipsis to the end.

{{truncate "Lorem ipsum dolor sit amet, consectetur adipiscing elit." 20 true}}
{{truncate phrase characterLimit useEllipsis}}

⬆️ back to top

underscore

Capitalizes a string using Ember.String.underscore.

{{underscore "whatsThat"}}
{{underscore phrase}}

⬆️ back to top

uppercase

Uppercases a string.

{{uppercase "loud noises"}}
{{uppercase phrase}}

⬆️ back to top

w

Splits a string on whitespace and/or turns multiple words into an array.

{{#each (w "First" "Second" "Last") as |rank|}}
  Our {{rank}} place winner is ...
{{/each}}

or:

{{#each (w "First Second Last") as |rank|}}
  Our {{rank}} place winner is ...
{{/each}}

See also: Ember w documentation

⬆️ back to top

See also:

Legal

Licensed under the MIT license

ember-cli-string-helpers's People

Contributors

andrewpye avatar asherlc avatar cibernox avatar ember-tomster avatar fpalluel avatar homu avatar josex2r avatar kevinansfield avatar maabernethy avatar nicomihalich avatar offirgolan avatar patrickberkeley avatar poteto avatar robbiespeed avatar romulomachado avatar rounders avatar rtablada avatar rwjblue avatar samselikoff avatar sirzach avatar skeate avatar spencer516 avatar taras avatar thomascchen avatar tzellman avatar ursm avatar victornamuso avatar vikram7 avatar willrax avatar xiphiasuvella avatar

Watchers

 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.