From 1cf7231488c21c5fdc9f1c039379d924669df6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E8=8B=A5=E9=9C=9C=E5=AF=92?= <912881342@qq.com> Date: Tue, 14 Jul 2020 09:05:42 +0800 Subject: [PATCH] fix: crypto each exports, close #473 (#830) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 饶培泽 --- shims/crypto/crypto.js | 46 +++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/shims/crypto/crypto.js b/shims/crypto/crypto.js index 7b0d83696..c1593ef88 100644 --- a/shims/crypto/crypto.js +++ b/shims/crypto/crypto.js @@ -67,22 +67,30 @@ function error () { exports.createHash = function (alg) { return hash(alg) }; exports.createHmac = function (alg, key) { return hash(alg, key) }; -function each(a, f) { - for(var i in a) - f(a[i], i) -} - -// the least I can do is make error messages for the rest of the node.js/crypto api. -each(['createCredentials' - , 'createCipher' - , 'createCipheriv' - , 'createDecipher' - , 'createDecipheriv' - , 'createSign' - , 'createVerify' - , 'createDiffieHellman' - , 'pbkdf2'], function (name) { - exports[name] = function () { - error('sorry,', name, 'is not implemented yet') - } -}); \ No newline at end of file +exports.createCredentials = () => { + error('sorry,createCredentials is not implemented yet'); +}; +exports.createCipher = () => { + error('sorry,createCipher is not implemented yet'); +}; +exports.createCipheriv = () => { + error('sorry,createCipheriv is not implemented yet'); +}; +exports.createDecipher = () => { + error('sorry,createDecipher is not implemented yet'); +}; +exports.createDecipheriv = () => { + error('sorry,createDecipheriv is not implemented yet'); +}; +exports.createSign = () => { + error('sorry,createSign is not implemented yet'); +}; +exports.createVerify = () => { + error('sorry,createVerify is not implemented yet'); +}; +exports.createDiffieHellman = () => { + error('sorry,createDiffieHellman is not implemented yet'); +}; +exports.pbkdf2 = () => { + error('sorry,pbkdf2 is not implemented yet'); +};