rename precision to decimals, add typeTags, continue refactoring
This commit is contained in:
parent
f41ac14698
commit
a58075c602
54 changed files with 426 additions and 256 deletions
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
|
||||
deepCopy: function(obj, precision) {
|
||||
deepCopy: function(obj) {
|
||||
|
||||
var copy = obj
|
||||
|
||||
|
|
@ -11,10 +11,8 @@ module.exports = {
|
|||
if (typeof obj === 'object') {
|
||||
copy = Array.isArray(obj) ? [] : {}
|
||||
for (let key in obj) {
|
||||
copy[key] = module.exports.deepCopy(obj[key], precision)
|
||||
copy[key] = module.exports.deepCopy(obj[key])
|
||||
}
|
||||
} else if (typeof obj == 'number') {
|
||||
return precision === undefined ? copy : parseFloat(copy.toFixed(precision))
|
||||
}
|
||||
|
||||
return copy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue