From fdce0096d091651a0c04aa09e12738ee13edd40a Mon Sep 17 00:00:00 2001 From: jakecastelli <959672929@qq.com> Date: Sun, 26 Feb 2023 18:24:24 +1030 Subject: [PATCH 1/2] doc: use destructing import --- doc/api/crypto.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 614c18d4887d65..5e5a3914bf62c5 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -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 From 9e393ed4eed41ed4b398a162ddb094caaa98d233 Mon Sep 17 00:00:00 2001 From: jakecastelli <959672929@qq.com> Date: Sun, 26 Feb 2023 18:24:59 +1030 Subject: [PATCH 2/2] doc: sort import order --- doc/api/crypto.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 5e5a3914bf62c5..560059a2312e47 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -178,8 +178,8 @@ console.log(Certificate.verifySpkac(Buffer.from(spkac))); ``` ```cjs -const { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); +const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); @@ -292,8 +292,8 @@ console.log(cert.verifySpkac(Buffer.from(spkac))); ``` ```cjs -const { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); +const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow();