doc: use destructing import

PR-URL: https://github.com/nodejs/node/pull/46847
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
jakecastelli authored and Node.js GitHub Bot committed 2023-02-28 08:11:55 +00:00
1 parent 7a37829ccb
commit d2d95a314f
1 file changed
+4 -4
+4 -4
View File
@@ -23,12 +23,12 @@ console.log(hash);
```
```cjs
const crypto = require('node:crypto');
const { createHmac } = require('node:crypto');
const secret = 'abcdefg';
const hash = crypto.createHmac('sha256', secret)
.update('I love cupcakes')
.digest('hex');
const hash = createHmac('sha256', secret)
.update('I love cupcakes')
.digest('hex');
console.log(hash);
// Prints:
// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e