Set of the String helpers extracted from DockYard's ember-composable-helpers.
Clone or download
Latest commit c2ac9ee Oct 30, 2018
Permalink
Failed to load latest commit information.
.circleci Fix CircleCI for real this time Feb 28, 2018
.github Add issue & PR templates, code of conduct and contributing docs (#212) Aug 22, 2016
addon Add tests for SafeString support May 30, 2018
app Add trim helper Mar 2, 2018
config Updated to ember-cli 3.5 Oct 30, 2018
lib Fix Node.js 4.x compatibility Jan 29, 2018
test eslint all the things Oct 9, 2017
tests Updated to ember-cli 3.5 Oct 30, 2018
vendor Initial Commit from Ember CLI v2.3.0 Feb 18, 2016
.bowerrc Initial Commit from Ember CLI v2.3.0 Feb 18, 2016
.editorconfig Upgrade Ember CLI to 2.7.0 + Suave'd (#207) Aug 23, 2016
.ember-cli Initial Commit from Ember CLI v2.3.0 Feb 18, 2016
.eslintignore Updated to ember-cli 3.5 Oct 30, 2018
.eslintrc.js Updated to ember-cli 3.5 Oct 30, 2018
.gitignore Updated to ember-cli 3.5 Oct 30, 2018
.npmignore Updated to ember-cli 3.5 Oct 30, 2018
.template-lintrc.js Updated to ember-cli 3.5 Oct 30, 2018
.travis.yml Updated to ember-cli 3.5 Oct 30, 2018
.watchmanconfig Initial Commit from Ember CLI v2.3.0 Feb 18, 2016
CODE_OF_CONDUCT.md Add issue & PR templates, code of conduct and contributing docs (#212) Aug 22, 2016
CONTRIBUTING.md Rename addon Nov 1, 2016
LICENSE.md Pipe helper Feb 18, 2016
README.md Update README to be more explicit Mar 29, 2018
ember-cli-build.js Updated to ember-cli 3.5 Oct 30, 2018
index.js Updated to ember-cli 3.5 Oct 30, 2018
package-lock.json Release v2.0.0 Oct 30, 2018
package.json Release v2.0.0 Oct 30, 2018
testem.js Updated to ember-cli 3.5 Oct 30, 2018
yarn.lock Add lock files Oct 30, 2018

README.md

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