Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from truststamp/fixed-validator-promise-check
Browse files Browse the repository at this point in the history
Fixed validationResult type check
  • Loading branch information
piotrpilz authored Sep 26, 2017
2 parents 4a9d046 + dc4497c commit 99fef18
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@
var validationResult = validation[validationKey](value, keyOrMap);
if (typeof validationResult === 'boolean') {
return !validationResult;
} else if (validationResult instanceof Promise) {
// better check if validationResult is a Promise; instanceof Promise was false on Safari
} else if (typeof validationResult.then === 'function'
&& typeof validationResult.catch === 'function') {

This comment has been minimized.

Copy link
@CezaryDanielNowak

CezaryDanielNowak Sep 26, 2017

Member

It would be better to create helper function next to isArray, isEmpty etc

promises[validationKey] = new Promise(function(resolve, reject) {
validationResult
.then(resolve, function() {
Expand Down

0 comments on commit 99fef18

Please sign in to comment.