What strategy to turn non-pure functions into a pure functions in JavaScript
问题 I'm starting to learn functional programming in javascript. This might be a silly question but what I'm trying to solve a non-pure function written in a functional way. My question is what strategy should be used to accomplish this in a functional programming paradigm. const crypto = require('crypto'); const encrypt = (data, publicKey) => { if (publicKey === undefined ) throw 'Missing public key.'; const bufferToEncrypt = Buffer.from(data); const encrypted = crypto.publicEncrypt({ key: