Browse Source

make "new Point()" work

patch-2
Ryan X. Charles 10 years ago
parent
commit
2ed5290a4e
  1. 7
      lib/point.js
  2. 5
      test/test.point.js

7
lib/point.js

@ -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);

5
test/test.point.js

@ -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…
Cancel
Save