-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
31 lines (25 loc) · 836 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*!
* is-valid-app <https://github.com/node-base/is-valid-app>
*
* Copyright (c) 2016-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var utils = require('./utils');
module.exports = function(app, name, types) {
if (typeof name !== 'string') {
throw new TypeError('expected plugin name to be a string');
}
// if `app` is not a valid instance of `Base`, or if `app` is a valid
// instance of Base by not one of the given `types` return false
if (!utils.isValid(app, types)) {
return false;
}
// if the `name` has already been registered as a plugin, return false
if (utils.isRegistered(app, name)) {
return false;
}
var debug = utils.debug('base:generate:' + name);
debug('initializing from <%s>', (module.parent && module.parent.id) || __dirname);
return true;
};