Skip to content

Commit

Permalink
Merge pull request #367 from kategengler/kg-htmlsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
kategengler authored Jan 3, 2023
2 parents 976db66 + f83417b commit e561fdd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@module @ember/string
*/
import Cache from './cache';
import { deprecate } from '@ember/debug';

// STATE within a module is frowned upon, this exists
// to support Ember.STRINGS but shield ember internals from this legacy global
Expand Down Expand Up @@ -250,3 +251,22 @@ export function underscore(str: string): string {
export function capitalize(str: string): string {
return CAPITALIZE_CACHE.get(str);
}

/*
The following are implemented here to give users adding `@ember/string` to
their projects a useful error message. The `ember-source` implementation of
`@ember/string` is clobbered by adding this addon, and so the deprecation of
the import path is not triggered. This error message is intended to help
users discover what they need to change.
*/
export function htmlSafe(str: string): void {
throw new Error(
'htmlSafe is not implemented in the `@ember/string` package. Please import from `@ember/template` instead.'
);
}

export function isHTMLSafe(str: any | null | undefined): void {
throw new Error(
'isHTMLSafe is not implemented in the `@ember/string` package. Please import from `@ember/template` instead.'
);
}

0 comments on commit e561fdd

Please sign in to comment.