-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
42 lines (37 loc) · 1.32 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
const _ = require('lodash');
const extend = require('./src/extend'),
entities = require('./src/entities'),
arrays = require('./src/arrays'),
errors = require('./src/errors'),
promises = require('./src/promises'),
strings = require('./src/strings'),
fs = require('./src/fs'),
math = require('./src/math'),
reflect = require('./src/reflect'),
trace = require('./src/mongoose_trace'),
lock = require('./src/lock'),
time = require('./src/time'),
Retry = require('./src/retry');
const self = {
trace, lock, time,
extend, entities, errors, promises, strings, fs, math, reflect, arrays, Retry,
...extend, ...entities, ...errors, ...promises, ...strings, ...fs, ...math, ...reflect, ...arrays
};
function buildMoredash() {
let omit = _.functions(_).filter(funcName => funcName !== 'toString');
return _.assign(_.runInContext(), _.omit(self, omit));
}
_.assign(self, {
moredash: buildMoredash(),
/**
* Append additional functions to the utility and moredash wrappers (functions with identical names
* will overrite existing functions)
* @param obj {Object} - an object containing the functions and properties to append
*/
use(obj) {
_.assign(this, obj);
this.moredash = buildMoredash();
return this;
}
});
module.exports = self;