bitpay/bitcore — pull request #273 by ryanxcharles (2014-04-19 23:16:52+00:00)
Title: WIP: Begin node/browser refactor: Split up Point into separate node and browser versions

The cryptography interface of bitcore is very lacking. If we're going to improve it, we're going to need to have a consistent and useful way to use C++ code in node and pure js code in the browser. This is my first attempt do to that for the Point class.

The way it works is like this:

* First, split up the Point class into Point.node and Point.browser
* Next, create a Point class that uses one check to see if we're in node, and then load the node version, and then exit. If it's not node, then load the browser version.

I wanted to simply build the browser version from Point.browser, and thus the conditional in the Point class should have been unnecessary. Unfortunately that method doesn't play well with browserify. When requiring Point inside another class, browserify would use always use the node version. Thus there needed to be a node version with conditional to load the browser version if necessary.