mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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:
1 parent
5ce6e99474
commit
04dd861221
30 files changed
+613
-614
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user