feat: Add utilities#assert [#95469256]#309
feat: Add utilities#assert [#95469256]#309alexanderGugel wants to merge 1 commit intoFamous:developfrom
Conversation
|
I think one of the best segments you guys had at jquerysf were the AST talks. Which has made me think a lot about how I could use AST and transformations such as this in my own practice. Which brings me to.... What is happening in this transformation? Without the browserify transformation you will just bring in the new utilities class Let me build this branch and see what the code looks like. |
Everything works perfectly fine without the transform. The transform basically optimizes the code by
It is also worth noting that while the script is primarily intended as a browserify transform, it simply returns a stream that can be used with arbitrary build tools. (https://github.com/Famous/engine/pull/309/files#diff-4f98559054de977c5dc700f456ec2185R12) |
|
Rebased. |
DOMRenderer previously had methods for asserting state. Putting those methods on the prototype makes it impossible for the minifier to do any kind of dead-code elimination. This commit adds an assert utility function used in order to check if a certain condition is met. Checking for NODE_ENV and not including the passed in error message in the thrown error should be trivial and only needs to be done once in the more generic assert function.
|
Rebased. |
Opened as PR for code review. Initially opened as issue #285
DOMRenderer previously had methods for asserting state.
Putting those methods on the prototype makes it impossible for the
minifier to do any kind of dead-code elimination.
This commit adds an assert utility function used in order to check
if a certain condition is met.
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.okin tape). The issue is to make this minifiable/ integrate with our existing tools.Feedback is very welcome. The main goal is to
@michaelobriena @DnMllr