From a77e8de965ce766e30a765a6ffed2fa8fa1b7754 Mon Sep 17 00:00:00 2001 From: Wenderson Pires Date: Tue, 23 Apr 2024 01:07:42 -0300 Subject: [PATCH] Add support to rename prop inside a destructuring --- lib/parsers/analyzeFunctionSignature.js | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/parsers/analyzeFunctionSignature.js b/lib/parsers/analyzeFunctionSignature.js index a8bd531..1b60dcc 100644 --- a/lib/parsers/analyzeFunctionSignature.js +++ b/lib/parsers/analyzeFunctionSignature.js @@ -34,7 +34,9 @@ const analyzeFunctionSignature = (code) => { capturedParams = params .map((param) => { if (isDestructuring) { - return `{${param.properties.map((prop) => prop.key.name).join(", ")}}`; + // return `{${param.properties.map((prop) => prop.key.name).join(", ")}}`; + // Add support to rename prop + return `{${param.properties.map((prop) => (prop.value.name ? `${prop.key.name}: ${prop.value.name}` : prop.key.name)).join(", ")}}`; } return param.name; }) @@ -51,7 +53,9 @@ const analyzeFunctionSignature = (code) => { capturedParams = params .map((param) => { if (isDestructuring) { - return `{${param.properties.map((prop) => prop.key.name).join(", ")}}`; + // return `{${param.properties.map((prop) => prop.key.name).join(", ")}}`; + // Add support to rename prop + return `{${param.properties.map((prop) => (prop.value.name ? `${prop.key.name}: ${prop.value.name}` : prop.key.name)).join(", ")}}`; } return param.name; }) diff --git a/package.json b/package.json index 66f9d34..0c53ab6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alem", "description": "Create web3 applications for NEAR BOS with a focus on performance and friendly development.", - "version": "1.0.0-beta.24", + "version": "1.0.0-beta.25", "main": "main.js", "types": "index.d.ts", "author": "Wenderson Pires - wendersonpires.near",