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

Open
#122 8 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.