Version Require
This module allows you to require a given version of a file, and to fall back to a previous version if the targeted version does not exist.
Usage
/** * Given directory structure: * * - models * - v3 * - video.js * - v3.1 * - show.js */var requireModels = './models'; // Load v3 of video.var video3 = ; // Load v3 of video, since 3.1 does not existvar video3_1 = ; // Throws an exception since show does not exist at the targeted version// or a previous version.var show3_1_err = ; // Resolves a path to the actual loaded module.var videoPath = requireModels;// __dirname + '/models/v3/video.js' // Exposes cached information from the modulevar cache = requireModelscache;// {// versions: ['v3', 'v3.1'],// paths: {// 'v3::video': './models/v3/video',// 'v3.1::video': './models/v3/video',// }// }