qodesmith / datepicker

Get a date with JavaScript! A datepicker with no dependencies.
344 stars 101 forks source link

Supporting strict mode #101

Closed james-em closed 4 years ago

james-em commented 4 years ago

Hi,

When using this library in strict mode, I am getting this error with uglify:

In strict mode code, functions can only be declared at top level or immediately within another function..

It would be great if the library could follow these specs :)

Thank you James

qodesmith commented 4 years ago

I use Webpack to bundle the entire library into a single function - and the code is already uglified with Terser, so I'm not sure how anything here is breaking specs. Is there anything else in the message? Otherwise I'm not sure it's Datepicker causing the issue.

qodesmith commented 4 years ago

A quick google search shows that this error comes up when functions are declared in for loops or in conditional statements. I was able to find a single instance where I declared a function in an if statement. I'll put up a change now :)

qodesmith commented 4 years ago

Ok, just pushed 5.16.0. All fixed.

james-em commented 4 years ago

@qodesmith

I forgot to say thank you ! It fixed the issue with uglify ! :)