-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Strip Symbol from production builds (#6389)
* Add a Symbol-like symbol (thank you glimmer-vm) This is similar to what is implemented here: https://github.com/glimmerjs/glimmer-vm/blob/72718d0d6ebb2614ec984f51435a44830d410e4c/packages/%40glimmer/reference/lib/validators.ts * Replace `Symbol`s that may be iterable by `symbol`s These occurences of Symbol might be replaced by this `symbol`, similar but different in the sense it is iterable.
- Loading branch information
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/store/addon/-private/ts-interfaces/utils/symbol.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
@module @ember-data/store | ||
*/ | ||
|
||
/** | ||
* This symbol provides a Symbol replacement for browsers that do not have it | ||
* (eg. IE 11). | ||
* | ||
* The replacement is different from the native Symbol in some ways. It is a | ||
* function that produces an output: | ||
* - iterable; | ||
* - that is a string, not a symbol. | ||
* | ||
* @internal | ||
*/ | ||
export const symbol = | ||
typeof Symbol !== 'undefined' | ||
? Symbol | ||
: (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any; |