Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support floats for assignVar/getVar #152

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

bookernath
Copy link
Contributor

What? Why?

Add support for floats in assignVar/getVar helpers by customer request.

How was it tested?

Test added.


cc @bigcommerce/storefront-team

jairo-bc
jairo-bc previously approved these changes Nov 16, 2021
if (!utils.isString(value) && !Number.isInteger(value)) {
throw new Error("assignVar helper value must be a string or a number (integer)");
// Validate that value is a string or Number (int/float)
if (!utils.isString(value) && isNaN(value)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use Number.isFinite(value) here for a more robust and less surprising implementation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite

@bookernath
Copy link
Contributor Author

@jairo-bc @mattolson ♻️

I think this is good to merge.

@jmwiese jmwiese merged commit d2a0b59 into bigcommerce:master Nov 23, 2021
@bookernath bookernath deleted the assignVar-floats branch November 30, 2021 19:21
@jairo-bc jairo-bc mentioned this pull request Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants