All modules will be cached - Deepstash
Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Machine Learning With Google

Discover 95 similar ideas in

It takes just

14 mins to read

All modules will be cached

Learning React or Node? Checkout my books: 

  • Learn React.js by Building Games  
  • Node.js Beyond the Basics  

6

6 reads

MORE IDEAS ON THIS

require.resolve

If you want to only resolve the module and not execute it, you can use the require.resolve function. This behaves exactly the same as the main require function, but does not load the file. It will still throw an error if the file does not exist and it will return the ful...

6

7 reads

Resolving a local path

Every Module object gets an Id property to identify it. This Id is usually the full path to the file, but in a Repl session it’s simply Repl>. Node allows many ways to require a file (for example, with a relative path or a Pre-Configured path) before we can load the content of a file into the me...

6

10 reads

Relative and absolute paths

Besides resolving modules from within the node_modules directories, we can also place the module anywhere we want and require it with either relative paths (./ and ../ ) or with absolute paths starting with /

6

6 reads

Parent-child relation between files

Create a Lib/Util.Js file and add a Console.Log line there to identify it. Also, Console.Log the Module object itself. Do the same for an Index.Js file, which is what we’ll be executing with Node: NOTE how the main index Module (Id:' .') is now listed as the parent for the Lib/Util Module.

6

6 reads

Circular module dependency

Module1 requires Module2, and Module2 requires Module1 while it wasn’t fully loaded. A property was reported because both B and C were exported after Module2 required and printed Module1. Node keeps this really simple: during the loading of a Module, it builds the exports object.

6

4 reads

JSON and C/C++ addons

If a file extension was not specified, the first thing Node will try to resolve is A.Js file. If it can’t find A.Json file, it will try A.Json file and it will Parse The.Json file if found as a Json text file. After that, it will try to find a Binary.Node file. To remove ambiguity,

6

4 reads

All code you write in Node will be wrapped in functions

Node wraps the Module code in a function, which we can inspect using the wrapper property of the Module Module. Exports is defined as a reference to Module.Exports prior to that. Require and Module are both specific to the function to be executed, and __Filename /_Dirname variables will contain t...

6

4 reads

The require object

We want to use this file in two ways: 

  • From the command line directly like this: 

6

5 reads

Requiring a folder

Create a Find-Me folder under Node_Modules and place an Index.Js file in there. The same require ('Find-Me') line will use that folder’s Index.Js file. We can control what file name to start with under the folder using the main property in Package.Json.

6

9 reads

exports, module.exports, and synchronous loading of modules

If you’ve noticed above, every time we’ve printed a Module object, it had an exports property which has been an empty object so far. So far, every time we printed a Module object, we saw a loaded attribute on that object with a value of false. The Module Module uses the loaded attribute to track ...

6

6 reads

Related collections

More like this

FREE CODE CAMP

FREE CODE CAMP

A diverse option in our free coding website list Free Code Camp is all about developing your coding knowledge while networking with other like-minded people in the industry. The solution allows you to learn coding by participating in challenges .

Be Flexible

Be Flexible

The best attribute to bring to a team is adaptability. To become more flexible in your thinking:

  • Keep learning. Jot down new information as you learn it.
  • Think beyond your role. Learn a little bit about everyone’s duties, especially those higher up on...

It's all about rescuing princess Peach from the evil Bowser

It's all about rescuing princess Peach from the evil Bowser

  • As a direct result of that attitude of learning and not being focused on the failures, we are able to learn a lot in order to win, in a very short amount of time. 
  • This is the Super Mario Effect: By shifting your focus to the princess and treating your life's challenges like...

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates