question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In utils.js we can find this piece of code:

const _ = require('lodash').runInContext(); // Prevent anyone messing with template settings by creating a fresh copy

So we are requesting out own instance of lodash that nobody has tempered with. However, all over the codebase lodash is most of the time required directly. Even more, this special instance is not even safe because in sequelize.js we can find:

/**
 * A reference to sequelize utilities. Most users will not need to use these utils directly. However, you might want to use `Sequelize.Utils._`, which is a reference to the lodash library, if you don't already have it imported in your project.
 * @property Utils
 */
Sequelize.prototype.Utils = Sequelize.Utils = Utils;

So we actually export this special lodash instance (and I don’t understand why - users can easily install require lodash themselves)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
janmeiercommented, May 29, 2016

Actually I think I we should remove the mention of utils completely from the docs

1reaction
janmeiercommented, May 29, 2016

Yeah, if we’re switching all usage of lodash templating to template strings there’s no really any reason to have a lodash reference in utils.

Originally we used run in context because a user reported problems with template strings - lodash allows you to override which characters are used in templates. But as you noticed, we’re not using it anyway…

Read more comments on GitHub >

github_iconTop Results From Across the Web

utils-lodash - npm
Start using utils-lodash in your project by running `npm i utils-lodash`. There are no other projects in the npm registry using utils-lodash.
Read more >
Lodash
A JavaScript utility library delivering consistency, modularity, performance, & extras.
Read more >
Lodash Utilities - GitHub
A modern JavaScript utility library delivering modularity, performance, & extras. ... Modular Lodash builds without the hassle. ... Smaller modular Lodash builds.
Read more >
Lodash Util Complete Reference - GeeksforGeeks
Lodash Util Complete Reference ... Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, ......
Read more >
Lodash - Util - Tutorialspoint
Lodash - Util, Lodash has many easy to use Utility methods. This chapter discusses them in detail.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found