Skip to content

Conversation

csvwolf
Copy link
Contributor

@csvwolf csvwolf commented Sep 8, 2016

My Leetcode Status is :

Easy 39/97 (40.21%) [..............................]
Medium 4/198 (2.02%) [..............................]
Hard 0/83 (0.00%) [..............................]

But when I run, it will throw an error since I have not done hard problems yet:

                    throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg)))
                    ^

TypeError: [sprintf] expecting number but found undefined

So I use a default value to fix it. Hope it's useful for the project.

@skygragon
Copy link
Owner

Thanks for patching!

The default value is clean and easy while it's a new feature from es6/es2015, which means older nodejs distributions don't support it by default. For example, in nodejs v5.6.0, we must use "--harmony_default_parameters" in calling to make it working.

IMHO It would be better to use a common way to fit different nodejs versions, e.g.

prettyLine('Easy', stats.acEasy || 0, stats.allEasy);

@csvwolf
Copy link
Contributor Author

csvwolf commented Sep 8, 2016

@skygragon Due to the compatibility, I suggest to modify the code in the function to avoid process every sentence of prettyLine

@skygragon
Copy link
Owner

LGTM. Thanks!

@skygragon skygragon merged commit e0a657a into skygragon:master Sep 8, 2016
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.

2 participants