adopted-ember-addons / adopted-ember-addons/validated-changeset

Change all apis on the Change, Data, all internal structures to be Symbols in order to not conflict with passed in data

Aberta
#122 8 comentários 1 reação 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
TypeScript
Estrelas
38
Forks
27
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Reproduction: https://runkit.com/nullvoxpopuli/reproduction-for-validated-changeset-122

for example,

```js
import { Changeset as createChangeset } from 'validated-changeset';

let data = {
trigger: { ...}
};

let changeset = createChangeset(data)
```
the data, `trigger` conflicts with: https://github.com/validated-changeset/validated-changeset/blob/ca0c7d249fc2244edaeb7aef25bdf06583628efa/src/index.ts#L144

I propose all internal APIS be assigned to private symbols instead of regular keys to not conflict with passed data:

example:
```js
const TRIGGER = Symbol('__private__trigger__');

// ...
[TRIGGER](eventName: string, ...args: any[]): void {
const notifier = notifierForEvent(this, eventName);

if (notifier) {
notifier.trigger(...args);
}
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.