make "new Point()" work

This commit is contained in:
Ryan X. Charles 2014-08-09 19:03:59 -07:00
parent c4064cc6e1
commit 2ed5290a4e
2 changed files with 11 additions and 1 deletions

View File

@ -2,9 +2,14 @@ var bn = require('./bn');
var elliptic = require('elliptic');
var ec = elliptic.curves.secp256k1;
var Point = ec.curve.point.bind(ec.curve)
var ecpoint = ec.curve.point.bind(ec.curve)
var p = ec.curve.point();
var Curve = Object.getPrototypeOf(ec.curve);
var Point = function Point(x, y, isRed) {
return ecpoint(x, y, isRed);
};
Point.prototype = Object.getPrototypeOf(p);
Point.fromX = ec.curve.pointFromX.bind(ec.curve);

View File

@ -8,6 +8,11 @@ describe('point', function() {
var p = point();
should.exist(p);
});
it('should create a point when called with "new"', function() {
var p = new point();
should.exist(p);
});
describe('#getX', function() {