npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-string-helpers

v6.1.0

Published

String helpers for Ember

Downloads

201,249

Readme

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