Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi
I've patched the code so that it should work as an AMD Module (with requireJS), a node module (as per commonJS syntax), or a browser global.
The declaration style keeps everything defined in a local scope and then only exposes window.numeric as a last resort.
I've done a build, and all unit tests pass
In order to get around the difficulty of the functions defined with the
Function
constructor, I had to wrap all of these constructions with a small internal function_fn()
which simply does the following:so that the body of a function created with the
Function
constructor (which doesn't have access to the scope that defines numeric), will have access to numeric viaI think this was the best way of getting around the scoping issues. But if anyone has a better way, I'm all ears.
Cheers!