MCPcopy Index your code
hub / github.com/adopted-ember-addons/ember-cli-string-helpers

github.com/adopted-ember-addons/ember-cli-string-helpers @v8.0.1-ember-cli-string-helpers

Chat with this repo
repository ↗ · DeepWiki ↗ · release v8.0.1-ember-cli-string-helpers ↗ · + Follow
13 symbols 51 edges 33 files 0 documented · 0% 6 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ember-cli-string-helpers

Download count all time CI npm version Ember Observer Score

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

[!WARNING]
If you are using single file components you most likely do not need this addon as it's just a wrapper on @ember/string methods. You can import most methods directly from @ember/string in your components, or migrate to something like change-case.

Compatibility

  • Ember.js v3.28 or above
  • Ember CLI v4.4 or above
  • Node.js v20 or above

Installation

ember install ember-cli-string-helpers

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 "

someString

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

Glint usage

If you are using Glint and environment-ember-loose, you can add all the helpers to your app at once by adding

import type EmberCliStringHelpersRegistry from 'ember-cli-string-helpers/template-registry';

to your app's e.g. types/glint.d.ts file, and making sure your registry extends from EmberCliStringHelpersRegistry:

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry
    extends EmberCliStringHelpersRegistry {
      // ...
    }
}

Template Tag usage

import { camelize } from 'ember-cli-string-helpers';

<template>
  {{camelize "hello jim bob"}}
</template>

See also

License

This project is licensed under the MIT License.

Extension points exported contracts — how you extend this code

EmberCliStringHelpersRegistry (Interface)
(no doc)
src/template-registry.ts

Core symbols most depended-on inside this repo

titleize
called by 1
src/utils/titleize.ts
uppercase
called by 0
src/utils/uppercase.ts
lowercase
called by 0
src/utils/lowercase.ts
trim
called by 0
src/utils/trim.ts
w
called by 0
src/helpers/w.ts
truncate
called by 0
src/helpers/truncate.ts
humanize
called by 0
src/helpers/humanize.ts
start
called by 0
tests/test-helper.ts

Shape

Function 8
Class 4
Interface 1

Languages

TypeScript100%

Modules by API surface

tests/test-helper.ts5 symbols
src/utils/uppercase.ts1 symbols
src/utils/trim.ts1 symbols
src/utils/titleize.ts1 symbols
src/utils/lowercase.ts1 symbols
src/template-registry.ts1 symbols
src/helpers/w.ts1 symbols
src/helpers/truncate.ts1 symbols
src/helpers/humanize.ts1 symbols

For agents

$ claude mcp add ember-cli-string-helpers \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page