Giter Club home page Giter Club logo

Comments (5)

ciaranj avatar ciaranj commented on May 10, 2024

Um, what ? Thats the module exports .. I'm a little confused, thats pretty standard in node isn't it ? (they're not global in the 'window' sense of the word)

from connect-auth.

Reinmar avatar Reinmar commented on May 10, 2024

If You don't declare variable it is global even in node. It is accessible from any other module. Try adding 'use strict'; at the beginnings of all files. It will throw an error.

Of course I'm talking about variable names I listed above. No the module.exports, which is standard for node.

from connect-auth.

ciaranj avatar ciaranj commented on May 10, 2024

hmm, interesting. I hadn't appreciated that (or used in for evil purposes) .. that code was re-factored to look like that by a contributor iirc and the pattern isn't used much elsewhere in the library. As it bleeds it should be removed yes I concur.

from connect-auth.

ciaranj avatar ciaranj commented on May 10, 2024

I tell a lie they're everywhere...um sorry.

from connect-auth.

Reinmar avatar Reinmar commented on May 10, 2024

Happily it should be easy to fix that :)
For future I recommend You switching to strict mode. It fixes that stupid JS behaviours.

I wanted to be sure that I'm right here, so I've made little example:

m1.js:

require('./m2.js');
require('./m3.js');
console.log('m1', a);

m2.js:

a = 1;

m3.js:

console.log('m3', a);

And the result for node m1 is:

$ node /www/tests/m1.js 
m3 1
m1 1

So this 'a' variable is accessible even in m3 module.

from connect-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.