update files

This commit is contained in:
nuintun
2015-11-23 21:47:32 +08:00
parent 75c28d020d
commit 0b8eb53557
3 changed files with 52 additions and 4 deletions

37
static/js/util/index.js Normal file
View File

@@ -0,0 +1,37 @@
/**
* Created by nuintun on 2015/11/23.
*/
'use strict';
module.exports = {
normalize: function (vue){
return JSON.parse(JSON.stringify(vue));
},
clone: function (object){
var result;
switch (typeof object) {
case 'object':
if (object === null) {
result = null;
} else {
if (Array.isArray(object)) {
result = object.slice(0);
} else {
result = {};
Object.keys(object).forEach(function (key){
result[key] = module.exports.clone(object[key]);
});
}
}
break;
default:
result = object;
break;
}
return result;
}
};