jayphelps / jayphelps/nofux

Property is not unpredictable

Open
#5 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
309
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Values are still assigned to predictable properties.

## Solution
Keep track of previous used property names and pick one at random when assigning.

```javascript
nofux.set('prop1', 'value1');
nofux.set('prop2', 'value2');

// Could (never should) lead to:
console.log(nofux.prop1); // 'value 2';
console.log(nofux.prop2); // undefined;
```

### ES2015 Proxies

By using [proxies](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-proxy-constructor) ([example](http://stackoverflow.com/questions/7891937/is-it-possible-to-implement-dynamic-getters-setters-in-javascript)), normal syntax can be used to set the properties.

```javascript
nofux.prop1 = 'value1';
nofux.prop2 = 'value2';

// Could (never should) lead to:
console.log(nofux.prop1); // 'value 2';
console.log(nofux.prop2); // undefined;
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named in the issue. Start by locating the property-assignment implementation and reviewing how property names are currently tracked; done means repeated assignments no longer preserve predictable property mappings while the shown direct-assignment syntax remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.