Since somebody asked me already elsewhere about the expected precedence of
the operator, this would be my answer:
```js
const result = await dbQuery(data) wrote:
> absolutely, I'm working with PostgreSQL these days and indeed for any
> promise/awaited result this pattern looks like a win, and
absolutely, I'm working with PostgreSQL these days and indeed for any
promise/awaited result this pattern looks like a win, and while it's
targeting a limitation of the chaining one, it can be used in various other
cases where knowing the initial result is more important than just falling
back to
Another pattern it could be useful in is with, say, nosql dbs where
something might be an object or id reference:
```
const fooId = foo
wrote:
> Another use case that I believe will be common is the following one:
>
> ```js
> // current state of the art
> const result = dbQuery(data)?.rows ??
Another use case that I believe will be common is the following one:
```js
// current state of the art
const result = dbQuery(data)?.rows ?? 'did it just failed or what?';
// VS the "mice operator"
const result = dbQuery(data) wrote:
> On Thu, Sep 5, 2019 at 2:39 PM Andrea Giammarchi
> wrote:
On Thu, Sep 5, 2019 at 2:39 PM Andrea Giammarchi
wrote:
>
> This is basically a solution to a common problem we have these days, where
> modules published in the wild might have a `default` property, to support ESM
> logic, or not.
>
> ```js
> // current optional chaining logic
> const imported
This is basically a solution to a common problem we have these days, where
modules published in the wild might have a `default` property, to support
ESM logic, or not.
```js
// current optional chaining logic
const imported = exported?.default ?? exported;
// my "mice operator" proposal
const
6 matches
Mail list logo