-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.js
46 lines (37 loc) · 842 Bytes
/
utils.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
var utils = require('lazy-cache')(require);
/**
* Lazily required module dependencies
*/
var fn = require;
require = utils;
require('extend-shallow', 'extend');
require('file-contents', 'contents');
require('is-registered');
require('is-valid-glob');
require('is-valid-instance');
require('isobject', 'isObject');
require('load-templates', 'Loader');
require = fn;
/**
* Return true if app is a valid instance
*/
utils.isValid = function(app) {
if (!utils.isValidInstance(app)) {
return false;
}
if (utils.isRegistered(app, 'assemble-loader')) {
return false;
}
return true;
};
/**
* Return true if obj is a View instance
*/
utils.isView = function(obj) {
return utils.isObject(obj) && (obj.path || obj.contents || obj.isView || obj.isItem);
};
/**
* Expose utils
*/
module.exports = utils;