From 885c220993d652200a5c051d5a7adf9efeab73be Mon Sep 17 00:00:00 2001 From: Dhruv Gramopadhye Date: Tue, 31 Jul 2018 23:48:18 -0400 Subject: [PATCH] NodeRSA.importKey() now returns this Sometimes we find the need to daisy chain or nest functions, and I felt that returning "`this`" would allow that to happen. This would let people do stuff like `new NodeRSA().importKey(...)`, although `new NodeRSA(...)` would technically be advantageous --- src/NodeRSA.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NodeRSA.js b/src/NodeRSA.js index 47b1855..bbd8d75 100644 --- a/src/NodeRSA.js +++ b/src/NodeRSA.js @@ -185,8 +185,10 @@ module.exports = (function () { if (!formats.detectAndImport(this.keyPair, keyData, format) && format === undefined) { throw Error("Key format must be specified"); } - + this.$cache = {}; + + return this; }; /**