Re: [whatwg/fetch] Body.json reviver (#104)

How does that preclude the platform from exposing a compatible API?

```js
function cpp_json(body) { /* native optimised C++ code */ }

Body.prototype.json = function(reviver) {
  return reviver ?
    this.text().then(text => JSON.parse(text, reviver)) : 
    cpp_json(this);
}
```

There, you have a consistent API. 
It has a fast path for users not needing a reviver and an easy to use API for users that do.

People, who need a reviver, will not suddenly _not_ need it anymore just because you don't expose an API for it.
Instead they will get frustrated, _not_ use your function and fallback to something else.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/104#issuecomment-395100746

Received on Wednesday, 6 June 2018 15:02:01 UTC