package: package refactoring

This commit is contained in:
bordun 2018-10-28 14:09:16 +01:00
parent 1b2da1750a
commit d0cc7f51aa
145 changed files with 175 additions and 847 deletions

24
src/main/utils.js Normal file
View file

@ -0,0 +1,24 @@
module.exports = {
deepCopy: function(obj, precision) {
var copy = obj
if (obj === null) {
return obj
}
if (typeof obj === 'object') {
copy = Array.isArray(obj) ? [] : {}
for (let key in obj) {
copy[key] = module.exports.deepCopy(obj[key], precision)
}
} else if (typeof obj == 'number') {
return precision === undefined ? copy : parseFloat(copy.toFixed(precision))
}
return copy
}
}