refactor: use _.assign

This commit is contained in:
harttle
2016-11-03 01:01:36 +08:00
parent f70b2ee203
commit c100a2e25e
3 changed files with 21 additions and 8 deletions
+3 -2
View File
@@ -148,8 +148,9 @@ function matchRightBracket(str, begin) {
}
exports.factory = function(_ctx, opts) {
opts = opts || {};
opts.strict = opts.strict || false;
opts = _.assign({
strict: false
}, opts);
var scope = Object.create(Scope);
scope.opts = opts;
+9
View File
@@ -25,6 +25,14 @@ function forOwn(object, iteratee) {
return object;
}
function assign(dst, src) {
dst = dst || {};
forOwn(src, function(v, k) {
dst[k] = v;
});
return dst;
}
function isArray(value) {
return value instanceof Array;
}
@@ -32,3 +40,4 @@ function isArray(value) {
exports.isString = isString;
exports.isArray = isArray;
exports.forOwn = forOwn;
exports.assign = assign;