Famous / Famous/engine

More systematic way for adding assertions

Open
#285 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

We are looking into brining more assertions into the engine.

Basically we are probably going to have an assert method that checks if a certain condition is being met and throw an error otherwise (basically like `t.ok` in tape). The issue is to make this minifiable/ integrate with our existing tools.

The proposed solution can be found here:
- Browserify transform: https://github.com/alexanderGugel/engine/blob/assert/scripts/optimize-assertions.js
- `assert()`: https://github.com/alexanderGugel/engine/blob/assert/utilities/assert.js
- Sample usage: https://github.com/alexanderGugel/engine/blob/assert/dom-renderers/DOMRenderer.js

Feedback is very welcome. The main goal is to
1. avoid unnecessary function calls (micro optimization - yay!)
2. have the ability to remove error messages for minification purposes.
3. avoid being locked into browserify by adding **optional** transform steps.

@michaelobriena

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.