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-string-fns

v1.4.1

Published

This addon provides string helpers for Ember templates and components.

Downloads

4,747

Readme

ember-string-fns npm version Build Status codecov

This addon provides string helpers for Ember templates and components.

To install:

ember install ember-string-fns

Usage

string-char-at

Get a character from a string at an index. See String.charAt() for details on the String.charAt function.

{{string-char-at 'ember' 2}}
{{string-char-at value index}}

string-char-code-at

Get a character by utf-16 code. See String.charCodeAt() for details on the String.charCodeAt function.

{{string-char-code-at '½' 0}}
{{string-char-code-at character index}}

string-code-point-at

Get a code by code point. See String.codePointAt() for details on the String.codePointAt function.

{{string-code-point-at '★' 0}}}
{{string-code-point-at character index}}

string-concat

Concatenate a series of strings. See String.concat() for details on the String.concat function.

{{string-concat 'i' ' ' 'love' ' ' 'ember'}}
{{string-concat firstName ' ' middleInitial ' ' lastName}}

string-ends-with

Returns true if a string ends with another string. See String.endsWith() for details on the String.endsWith function.

{{string-ends-with 'i love ember' 'ember'}}
{{string-ends-with haystack needle}}

string-equals

Determines if a string equals another string.

{{string-equals 'ember' 'react'}}
{{string-equals 'ember' 'react' 'vue'}}
{{string-equals value1 value2}}
{{string-equals value1 value2 value3}}

string-from-char-code

Get a character from utf-16 codes. See String.fromCharCode() for details on the String.fromCharCode function.

{{string-from-char-code 189}}
{{string-from-char-code charCode}}

string-from-code-point

Get a character from code points. See String.fromCodePoint() for details on the String.fromCodePoint function.

{{string-from-code-point 9733}}
{{string-from-code-point codePoint}}

string-html-safe

Output an HTML safe string. See htmlSafe() for details on the htmlSafe function.

{{string-html-safe '<b>bold text</b>'}}
{{string-html-safe htmlText}}

string-includes

Returns true if a string includes another string. See String.includes() for details on the String.includes function.

{{string-includes 'i love ember framework' 'ember'}}
{{string-includes haystack needle}}

string-index-of

Returns the first occurrence index where the substring begins. See String.indexOf() for details on the String.indexOf function.

{{string-index-of 'i love ember' 'ember'}}
{{string-index-of haystack needle}}

string-last-index-of

Returns the last occurrence index where the substring begins. See String.lastIndexOf() for details on the String.lastIndexOf function.

{{string-last-index-of 'i love love ember'}}
{{string-last-index-of haystack needle}}

string-not-equals

Determines if a string does not equal another string.

{{string-not-equals 'ember' 'react'}}
{{string-not-equals value1 value2}}

string-pad-end

Returns true if a string ends with another string. See String.padEnd() for details on the String.padEnd function.

{{string-pad-end 'ember' '.' 8}}
{{string-pad-end string endPadWith totalCharacterCount}}

string-pad-start

Returns true if a string ends with another string. See String.padStart() for details on the String.padStart function.

{{string-pad-start 'ember' '.' 8}}
{{string-pad-start string frontPadWith totalCharacterCount}}

string-repeat

Repeat a string a number of times. See String.repeat() for details on the String.repeat function.

{{string-repeat 'ember' 3}}
{{string-repeat string 3}}

string-replace

Replace first occurence of a string with another string.

{{string-replace 'i love react' 'react' 'ember'}}
{{string-replace hackstack needle thimble}}

string-replace-all

Replace all occurences of a string with another string.

{{string-replace-all 'i love react, react programming' 'react' 'ember'}}
{{string-replace-all hackstack needle thimble}}

string-slice

Extract a slice from a string. See String.slice() for details on the String.slice function.

{{string-slice 'i love ember' 7}}
{{string-slice 'i love ember' 7 12}}
{{string-slice string beginIndex}}
{{string-slice string beginIndex endIndex}}

string-split

Split a string into a string[] by a delimiter. See String.split() for details on the String.split function.

{{string-split 'a.b.c' '.'}}
{{string-split string delimiter}}

string-starts-with

Returns true if a string starts with another string. See String.startsWith() for details on the String.startsWith function.

{{string-starts-with 'ember i love' 'ember'}}
{{string-starts-with haystack needle}}

string-substring

Extract a substring from a string. See String.substring() for details on the String.substring function.

{{string-substring 'i love ember' 7}}
{{string-substring 'i love ember' 7 12}}
{{string-substring string beginIndex}}
{{string-substring string beginIndex endIndex}}

string-to-camel-case

Convert a string to camel case (camelCase). See Camel Case for details.

{{string-to-camel-case 'camel case'}}
{{string-to-camel-case variableName}}

string-to-kebab-case

Convert a string to kebab case (kebab-case). See Kebab Case for details.

{{string-to-kebab-case 'kebab case'}}
{{string-to-kebab-case variableName}}

string-to-lower-case

Convert a string to lower case. See String.toLowerCase() for details on the String.toLowerCase function.

{{string-to-lower-case 'robert'}}
{{string-to-lower-case firstName}}

string-to-pascal-case

Convert a string to pascal case (PascalCase). See Pascal Case for details.

{{string-to-pascal-case 'pascal case'}}
{{string-to-pascal-case variableName}}

string-to-sentence-case

Convert a string to sentence case (Sentence case.). See Sentence Case for details. Note, sentences are considered a group of words that are completed with a !, ?, or .

{{string-to-sentence-case 'i love ember!'}}
{{string-to-sentence-case sentence}}

string-to-snake-case

Convert a string to snake case (snake_case). See Snake Case for details.

{{string-to-snake-case 'snake case'}}
{{string-to-snake-case variableName}}

string-to-title-case

Convert a string to title case (Title Case). See Title Case for details. Note, due to the subjectivity of subsets, all words are operated against.

{{string-to-title-case 'pulp fiction'}}
{{string-to-title-case movieTitle}}

string-to-upper-case

Convert a string to upper case. See String.toUpperCase() for details on the String.toUpperCase function.

{{string-to-upper-case 'frank'}}
{{string-to-upper-case lastName}}

string-trim

Trim the start and end of a string. See String.trim() for details on the String.trim function.

{{string-trim '   ember   '}}
{{string-trim string}}

string-trim-end

Trim the end of a string. See String.endsWith() for details on the String.endsWith function.

{{string-trim-end 'ember   '}}
{{string-trim-end string}}

string-trim-start

Trim the start of a string. See String.trimStart() for details on the String.trimStart function.

{{string-trim-start '   ember'}}
{{string-trim-start string}}

Related Addons

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.