sagiv.bengiat at gmail.com (2018-02-17T21:24:19.079Z)
>Also, you can just use return if you're in a function: That's not what i'm looking for. I may want to do some more things inside the function besides validations. Sagiv b.g
>Also, you can just use return if you're in a function: That's not what i'm looking for. I may want to do some more things inside the function besides validations. Sagiv b.g
That's not what i'm looking for. I may want to do some more things inside the function besides validations. Sagiv b.g On Sat, Feb 17, 2018 at 11:19 PM, Peter Jaszkowiak <p.jaszkow at gmail.com> wrote: > Also, you can just use `return` if you're in a function: > > ``` > const doWork = () => { > // try catch omitted for brevity > const response = fetchData(); > > if (response.error) { > log(response.message); > return; > } > if (!response.data) { > log("No data"); > return; > } > if (!response.data.todos) { > log("No Todos"); > return; > } > > return action({ data: response.data }); > }; > ``` > > On Sat, Feb 17, 2018 at 2:17 PM, Oriol _ <oriol-bugzilla at hotmail.com> > wrote: > >> This is so close to your proposal, and already works right now: >> >> ```js >> block: { >> if (response.error) { >> log(response.message); >> break block; >> } >> if (!response.data) { >> log("No data"); >> break block; >> } >> if (!response.data.todos) { >> log("No Todos"); >> break block; >> } >> return action({ data: response.data }); >> } >> ``` >> >> - Oriol >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180217/a003c7a9/attachment.html>