Skip to content
New issue

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

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

Already on GitHub? # to your account

getOption falsy key behavior differs from native js object #3701

Open
taburetkin opened this issue Mar 8, 2022 · 0 comments
Open

getOption falsy key behavior differs from native js object #3701

taburetkin opened this issue Mar 8, 2022 · 0 comments

Comments

@taburetkin
Copy link
Contributor

Description

the getOption method have falsy check for keyName and this may lead for some unexpected results.
link to source:

if (!optionName) { return; }

example:

const falsyKey = 0;
const view = new Mn.View({ [falsyKey]: 'some value' });
console.log(view.getOption(falsyKey)) // undefined;
console.log(view.options[falsyKey]) // somev value;

the codepen: https://codepen.io/dimatabu/pen/vYWwyMR?editors=0010

solution:

const getOption = function(optionName) {
-  if (!optionName) { return; }
+ if (!arguments.length) { return; }
};
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant