doc: fix, modernize examples in docs

* Use single quotes consistently
* Modernize examples to use template strings and arrow funcs
* Fix a few typos
* Example edits for consistency

PR-URL: https://github.com/nodejs/node/pull/4282
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
James M Snell authored and Jeremiah Senkpiel committed 2016-01-06 11:37:13 -05:00
1 parent 5ce6e99474
commit 04dd861221
30 files changed
+613 -614

No files matched your search

+4 -4
View File
@@ -6,13 +6,13 @@ To use this module, do `require('string_decoder')`. StringDecoder decodes a
buffer to a string. It is a simple interface to `buffer.toString()` but provides
additional support for utf8.
var StringDecoder = require('string_decoder').StringDecoder;
var decoder = new StringDecoder('utf8');
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
var cent = new Buffer([0xC2, 0xA2]);
const cent = new Buffer([0xC2, 0xA2]);
console.log(decoder.write(cent));
var euro = new Buffer([0xE2, 0x82, 0xAC]);
const euro = new Buffer([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));
## Class: StringDecoder