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 elliptic = require('elliptic');
|
||||||
|
|
||||||
var ec = elliptic.curves.secp256k1;
|
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 p = ec.curve.point();
|
||||||
var Curve = Object.getPrototypeOf(ec.curve);
|
var Curve = Object.getPrototypeOf(ec.curve);
|
||||||
|
|
||||||
|
var Point = function Point(x, y, isRed) {
|
||||||
|
return ecpoint(x, y, isRed);
|
||||||
|
};
|
||||||
|
|
||||||
Point.prototype = Object.getPrototypeOf(p);
|
Point.prototype = Object.getPrototypeOf(p);
|
||||||
|
|
||||||
Point.fromX = ec.curve.pointFromX.bind(ec.curve);
|
Point.fromX = ec.curve.pointFromX.bind(ec.curve);
|
||||||
|
|||||||
@ -9,6 +9,11 @@ describe('point', function() {
|
|||||||
should.exist(p);
|
should.exist(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create a point when called with "new"', function() {
|
||||||
|
var p = new point();
|
||||||
|
should.exist(p);
|
||||||
|
});
|
||||||
|
|
||||||
describe('#getX', function() {
|
describe('#getX', function() {
|
||||||
|
|
||||||
it('should return 0', function() {
|
it('should return 0', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user