From e94ec0091900a5537ee26688faeebf1b0134b15c Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 25 Aug 2015 13:47:11 +1000 Subject: [PATCH] types: restore quacking behaviour --- src/types.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/types.js b/src/types.js index 94731c8..9ee5c6f 100644 --- a/src/types.js +++ b/src/types.js @@ -1,5 +1,3 @@ -var bigi = require('bigi') -var ecurve = require('ecurve') var typeforce = require('typeforce') function nBuffer (value, n) { @@ -24,9 +22,9 @@ function UInt53 (value) { } // external dependent types -function BigInt (value) { return !typeforce.Null(value) && value.constructor === bigi } -function ECCurve (value) { return !typeforce.Null(value) && value.constructor === ecurve.Curve } -function ECPoint (value) { return !typeforce.Null(value) && value.constructor === ecurve.Point } +var BigInt = typeforce.quacksLike('BigInteger') +var ECCurve = typeforce.quacksLike('Curve') +var ECPoint = typeforce.quacksLike('Point') // exposed, external API var ECSignature = typeforce.compile({ r: BigInt, s: BigInt })