Looker
A utility library to help finding and loading files or modules. Give looker
a set of paths to look in, and then call one of looker
's methods to find and load the file. Paths can be specified with a priority, so you can specify a cascading set of places to look and only load the first matching result. This library can also be used to require
in javascript files into a node app.
Examples
// Create a new lookervar look = 'looker'; // Add some lookup pathslook;look; // A lookup path to look in first,// The default priority is 500, so// any path with a lower priority value// will be looked in first. This will// look two directories up before// looking in the next twolook; // Check if a file existslook; // Read a file contentlook; // Require a filelook; // Require a module, syncvar m = look;if !m // Module not found else // Do something with the module // Require all files the directoreslook; // Try for a file name in each lookup pathlook;