UNPKG

877 BJavaScriptView Raw
1/*
2 Copyright (c) 2014 Google Inc. All rights reserved.
3
4 Use of this source code is governed by the MIT License, available in this package's LICENSE file
5 or at http://opensource.org/licenses/MIT.
6 */
7const _ = require('lodash');
8const Requizzle = require('./lib/requizzle');
9
10module.exports = function requizzle(options) {
11 let instance;
12
13 if (!options || typeof options !== 'object') {
14 throw new TypeError('Requizzle\'s options parameter must be a non-null object.');
15 }
16 options = _.clone(options);
17 options.parent = module.parent;
18
19 return filepath => {
20 instance = instance || new Requizzle(options);
21
22 return instance.requizzle(filepath);
23 };
24};
25module.exports.Requizzle = Requizzle;
26
27// force Node.js to reload this module each time it's required, so module.parent is always correct
28delete require.cache[__filename];