mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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:
1 parent
7a37829ccb
commit
d2d95a314f
1 file changed
+4
-4
+4
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user