u
This commit is contained in:
parent
852e82d5a9
commit
13c101a451
@ -20,7 +20,6 @@ module.exports = {
|
|||||||
let newObj = {}
|
let newObj = {}
|
||||||
if (schemaColumns) {
|
if (schemaColumns) {
|
||||||
for (let key in schemaColumns) {
|
for (let key in schemaColumns) {
|
||||||
if (schemaColumns.hasOwnProperty(key) && !schemaColumns[key].hashExclusive && !excludeKeys.includes(key)) {
|
|
||||||
// JSON.stringify (包括本函数)会把 NaN 或 Infinity 输出为 null,会把 undefined 忽略掉。
|
// JSON.stringify (包括本函数)会把 NaN 或 Infinity 输出为 null,会把 undefined 忽略掉。
|
||||||
// 而在 typeorm sqlite 数据库中,undefined 会自动存为 schemaColumns[key].default 或 null。从数据库读出时,就会和事先JSON.stringify的结果不一致。
|
// 而在 typeorm sqlite 数据库中,undefined 会自动存为 schemaColumns[key].default 或 null。从数据库读出时,就会和事先JSON.stringify的结果不一致。
|
||||||
// 为了和 torm 数据库保持一致习惯,对schemaColumns里的键值应当把 undefined 也设为 default 或 null。
|
// 为了和 torm 数据库保持一致习惯,对schemaColumns里的键值应当把 undefined 也设为 default 或 null。
|
||||||
@ -31,10 +30,12 @@ module.exports = {
|
|||||||
newObj[key] = obj[key]
|
newObj[key] = obj[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
newObj = obj
|
newObj = obj
|
||||||
}
|
}
|
||||||
|
for (let exkey of excludeKeys) {
|
||||||
|
delete newObj[exkey]
|
||||||
|
}
|
||||||
|
|
||||||
/* 以下代码来自 https://github.com/substack/json-stable-stringify 可把嵌套的复杂值也按顺序输出,例如 { c: 8, b: [{z:6,y:5,x:4},7], a: 3 } */
|
/* 以下代码来自 https://github.com/substack/json-stable-stringify 可把嵌套的复杂值也按顺序输出,例如 { c: 8, b: [{z:6,y:5,x:4},7], a: 3 } */
|
||||||
if (typeof space === 'number') space = Array(space + 1).join(' ')
|
if (typeof space === 'number') space = Array(space + 1).join(' ')
|
||||||
|
Loading…
Reference in New Issue
Block a user