DEV Community

Cover image for What to use instead of `@ember/string`
NullVoxPopuli
NullVoxPopuli

Posted on

6 1

What to use instead of `@ember/string`

@ember/string is trying to be phased out -- I've found that change-case is a better alternative to @ember/string, because it supports more transformations, is true native ESM, and can be anywhere, even outside of ember, or in plain html files!

Here is how you migrate:

camelize

If you use camelize in @ember/string, use this instead:

import { camelCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

capitalize

If you use capitalize in @ember/string, use this instead:

import { capitalCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

classify

If you use classify in @ember/string, use this instead:

import { pascalCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

dasherize

If you use dasherize in @ember/string, use this instead:

import { kebabCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

decamelize

If you use decamelize in @ember/string, use this instead:

import { snakeCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

underscore

If you use underscore in @ember/string, use this instead:

import { snakeCase } from 'change-case';
Enter fullscreen mode Exit fullscreen mode

## w

If you use w in @ember/string, use this instead:

let result = `long string with words`.split(/\s+/);
//  ^ ['long', 'string', 'with', 'words']
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More