dominictarr/json-buffer — pull request #5 by eugeneware (2014-04-14 11:02:33+00:00)
Title: Stringifying undefined in arrays should be null

The result of:

``` js
JSON.stringify([undefined, 1 ' two']);
```

Should be:

``` js
'[null,1,"two"]'
```

From crockford's [json2js](https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L73-L77):

Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.

This PR fixes `json-buffer` to handle `undefined` in arrays correctly.

This is particularly important because `rpc-stream` uses `json-buffer` to stringify array arguments, and when there is no error as the first argument, often `undefined`, the first argument gets removed completely, messing up the callback function.