make "new Point()" work
This commit is contained in:
parent
c4064cc6e1
commit
2ed5290a4e
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue