GitXplorerGitXplorer
r

ember-cli-string-helpers

public
73 stars
30 forks
33 issues

Commits

List of commits on branch master.
Unverified
2d4f18a1e7f342ea0a0f4575bd0ddad6194e5a62

Update circleci config

rromulomachado committed 3 years ago
Unverified
892a435c3c39fccf32e5b85f36047f145e73f09b

Update links to point to adopted-ember-addons org

rromulomachado committed 3 years ago
Unverified
69044b0c49cd66fb276c963c7219b02c7385dfa3

Update links on package.json for move to adopter-ember-addons

rromulomachado committed 3 years ago
Unverified
833ce8c3e22dad6a8659b14cc1cd49925e3103ca

6.1.0

rromulomachado committed 4 years ago
Unverified
632480cf302469bf37a1c2d937589b1d88dbeddb

6.1.0

rromulomachado committed 4 years ago
Verified
e2f0d8db3a0403f042c8170b91cda847b17505bf

Merge pull request #316 from concordnow/use_yarn

rromulomachado committed 4 years ago

README

The README file for this repository.

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 ember-cli-build.js:

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    '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}}

Output: helloJimBob

⬆️ back to top

capitalize

Capitalizes a string using Ember.String.capitalize.

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

Output: Hello jim bob

⬆️ back to top

classify

Classifies a string using Ember.String.classify.

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

Output: HelloJimBob

⬆️ back to top

dasherize

Dasherizes a string using Ember.String.dasherize.

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

Output: whats-that

⬆️ 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}}

Output: Some string

⬆️ back to top

lowercase

Lowercases a string.

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

Output: people person's paper people

⬆️ back to top

titleize

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

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

Output: My Big Fat Greek Wedding

⬆️ back to top

trim

Trim a string.

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

Output: Lorem ipsum dolor sit amet, consectetur adipiscing elit.

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}}

Output: Lorem ipsum dolor...

⬆️ back to top

underscore

Underscores a string using Ember.String.underscore.

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

Output: whats_that

⬆️ back to top

uppercase

Uppercases a string.

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

Output: LOUD NOISES

⬆️ 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