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

add default callback support #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crazy4groovy
Copy link

@humanwhocodes:

tests passing.

feedback?

@crazy4groovy crazy4groovy force-pushed the default-callback branch 5 times, most recently from 5ab1f9f to 962cdea Compare November 6, 2021 18:01
if (typeof defaultValue === "function") {
// resolve the callback defaultValue
defaultValue = defaultValue(index);
return target[property] = defaultValue;
Copy link
Author

Choose a reason for hiding this comment

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

We could also only assign to target[property] if the resolved defaultValue is an object. There are this.length implications either way. Thoughts?

@crazy4groovy crazy4groovy force-pushed the default-callback branch 2 times, most recently from 9e00017 to befe222 Compare November 9, 2021 15:09
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