UNPKG

850 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 */
7'use strict';
8
9var _ = require('underscore');
10var Requizzle = require('./lib/requizzle');
11
12module.exports = function requizzle(options) {
13 var instance;
14
15 if (!options || typeof options !== 'object') {
16 throw new TypeError('Requizzle\'s options parameter must be a non-null object.');
17 }
18 options = _.clone(options);
19 options.parent = module.parent;
20
21 return function(filepath) {
22 instance = instance || new Requizzle(options);
23 return instance.requizzle(filepath);
24 };
25};
26module.exports.Requizzle = Requizzle;
27
28// force Node.js to reload this module each time it's required, so module.parent is always correct
29delete require.cache[__filename];