> return AFS.stat(path)
>    .fail(error => null) // map failure to success condition
>    .then(stat =>
>
>        if (!stat)    // Path doesn't exist - create the directory
>            return AFS.mkdir(path);
>        else if (stat.isDirectory())    // done already
>            return 'nothing to do';
>        else    // no can do
>
>            throw new Error("Path is not a directory.");
>
>    ).then(val => console.log("done"));
>
>
Provided that fail provides the implicit success handler `val => val`, I
think that's correct.  Question:  is one-arg `then` + `fail` equally as
powerful as two-arg then?  Proof?

- Kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to