fix: rebiew comments
Signed-off-by: Samarpan Bhattacharya <this.is.samy@gmail.com>
This commit is contained in:
parent
7a02f12194
commit
28dec15d0a
|
@ -562,7 +562,7 @@ SQLConnector.prototype.buildInsertAll = function(model, data, options) {
|
|||
return null;
|
||||
}
|
||||
const fieldsArray = this.buildFieldsFromArray(model, data);
|
||||
if (fieldsArray.length === 0) {
|
||||
if (Array.isArray(fieldsArray) && fieldsArray.length === 0) {
|
||||
debug('no fields found for insert query');
|
||||
// return immediately if no fields found
|
||||
return null;
|
||||
|
@ -1269,7 +1269,7 @@ SQLConnector.prototype.buildFields = function(model, data, excludeIds) {
|
|||
*/
|
||||
SQLConnector.prototype.buildFieldsFromArray = function(model, data, excludeIds) {
|
||||
const fields = [];
|
||||
if (data.length > 0) {
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
const keys = Object.keys(data[0]);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
fields.push(this._buildFieldsForKeys(model, data[i], keys, excludeIds));
|
||||
|
|
Loading…
Reference in New Issue