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

Fix undefined variable error under strict mode #11

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

Conversation

MasterOdin
Copy link

When trying to use this module in a vite project, we got a ReferenceError, due to this module running under "use strict"; mode, similar to this error:

/home/mpeveler/parameterize.js:185
parameterize = function(s, num_chars, delimiter) {
             ^

ReferenceError: parameterize is not defined
    at Object.<anonymous> (/home/mpeveler/parameterize.js:185:14)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

This PR fixes that error by making sure that parameterize is defined using var, similar to the other variables in the file.

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