Yet another variation, but not necessarily more readable:

```js
try {
  return (id = p(d)) != null && (typeof id === "number"
      ? !isNaN(id)
      : (id += "", true));
 } catch (ignore) {}
```

If we treat `id=""` the same as null, we can drop the `true` (same with the non-ternary variation).