Skip to content

Conversation

@inglkruiz
Copy link

Hi, I'm not entirely sure if this is the correct fix but while using the SDK I had an issue when consuming webhook events.

It does not seem correct to set it to null because the user is needed for getting the public key.

getPublicKey = async function (user = starkBank.user) 

Consider the following please

JavaScript Default Parameters with null or empty Argument
If we do not provide any value for the function parameter then the default value is used, but what if someone provides null or an empty string as value. In that case null and empty value is considered valid and default parameter value is not used.

Hi, I'm not entirely sure if this is the correct fix but while using the SDK I had an issue when consuming webhook events.

It does not seem correct to set it to `null` because the user is needed for getting the public key.

```ts
getPublicKey = async function (user = starkBank.user) 
```

Consider the following please

> JavaScript Default Parameters with null or empty Argument
If we do not provide any value for the function parameter then the default value is used, but what if someone provides null or an empty string as value. In that case null and empty value is considered valid and default parameter value is not used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant