diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-01 01:21:22 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-03 01:33:55 +0300 |
commit | 7de6998d899125e9d43de7dae0bb0a0ed9a76d34 (patch) | |
tree | 73f0c31fe41024a56ea06910d01c5a0714b334b0 /doc/api/string_decoder.md | |
parent | 78b135806f10c39c3bbd00edf206ddc9f505597e (diff) | |
download | android-node-v8-7de6998d899125e9d43de7dae0bb0a0ed9a76d34.tar.gz android-node-v8-7de6998d899125e9d43de7dae0bb0a0ed9a76d34.tar.bz2 android-node-v8-7de6998d899125e9d43de7dae0bb0a0ed9a76d34.zip |
doc: use destructuring in code examples
PR-URL: https://github.com/nodejs/node/pull/13349
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/string_decoder.md')
-rw-r--r-- | doc/api/string_decoder.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/api/string_decoder.md b/doc/api/string_decoder.md index 6b94b6bc3f..5757ba6e2b 100644 --- a/doc/api/string_decoder.md +++ b/doc/api/string_decoder.md @@ -7,13 +7,13 @@ strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. It can be accessed using: ```js -const StringDecoder = require('string_decoder').StringDecoder; +const { StringDecoder } = require('string_decoder'); ``` The following example shows the basic use of the `StringDecoder` class. ```js -const StringDecoder = require('string_decoder').StringDecoder; +const { StringDecoder } = require('string_decoder'); const decoder = new StringDecoder('utf8'); const cent = Buffer.from([0xC2, 0xA2]); @@ -32,7 +32,7 @@ In the following example, the three UTF-8 encoded bytes of the European Euro symbol (`€`) are written over three separate operations: ```js -const StringDecoder = require('string_decoder').StringDecoder; +const { StringDecoder } = require('string_decoder'); const decoder = new StringDecoder('utf8'); decoder.write(Buffer.from([0xE2])); |