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

Đang mở
#122 8 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
38
Fork
27
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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);
}
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.