Skip to content

require it is normal or not? #3404

Description

@alexander-akait
for (var i = 0; i < 10; i++) {
    var jsonObject = require('file.json');

    functionChangeJsonObject(jsonObject);
}

First call require load file from filesystem, second call get this file from cache (reference on object). But my function(s) may be change this object. And second call require return changed object. It is normal behavior or not?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions