-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
52 lines (45 loc) · 989 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
47
48
49
50
51
52
'use strict';
/**
* Module dependencies
*/
var utils = require('lazy-cache')(require);
var fn = require;
require = utils;
/**
* Lazily required module dependencies
*/
require('base-store', 'store');
require('clone-deep', 'clone');
require('define-property', 'define');
require('extend-shallow', 'extend');
require('get-value', 'get');
require('is-valid-app', 'isValid');
require('isobject', 'isObject');
require('mixin-deep', 'merge');
require('question-store', 'Questions');
require('set-value', 'set');
require = fn;
utils.sync = function(obj, prop, val) {
var cached;
utils.define(obj, prop, {
configurable: true,
enumerable: true,
set: function(v) {
cached = v;
},
get: function() {
if (typeof cached !== 'undefined') {
return cached;
}
if (typeof val === 'function') {
val = val.call(obj);
}
cached = val;
return val;
}
});
};
/**
* Expose `utils` modules
*/
module.exports = utils;