interledgerjs / five-bells-condition

JavaScript implementation of Crypto Conditions validation and fulfillment
https://github.com/rfcs/crypto-conditions
Other
31 stars 21 forks source link

Readme has confusing example usage of validateFulfillment #59

Open clark800 opened 7 years ago

clark800 commented 7 years ago

The following snippet found in a few places in the readme makes it look like validateFulfillment returns a boolean to indicate validation whereas it actually throws an error for invalid fulfillments.

const validationResult = cc.validateFulfillment(fulfillment, condition)
// validationResult === true
KrishnaPG commented 6 years ago

Created new issue to request to use return values for validation results, instead of throwing errors.

There is no apparent reason to throw errors, when they could be just handled as normal function return values. If someone needs to wrap a promise around the return values, it would make their life easier to debug when you are trying to validate an array of fulfillments.