From 843748aa994d5d9fba6cf7df2ce4f026a53487ba Mon Sep 17 00:00:00 2001 From: Chen Yangjian <252317+cyjake@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:34:46 +0800 Subject: [PATCH] upgrade: mysql2 >= 3.9.4 --- package.json | 4 ++-- src/bone.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 772c2084..40f5b619 100644 --- a/package.json +++ b/package.json @@ -120,11 +120,11 @@ "eslint-plugin-no-only-tests": "^3.0.0", "expect.js": "^0.3.1", "husky": "^8.0.3", - "jsdoc": "^3.6.3", + "jsdoc": "^4.0.2", "lint-staged": "^13.2.2", "mocha": "^10.2.0", "mysql": "^2.17.1", - "mysql2": "^2.3.0", + "mysql2": "^3.9.4", "nyc": "^15.1.0", "pg": "^8.5.1", "sinon": "^10.0.0", diff --git a/src/bone.js b/src/bone.js index c021b7f0..6577c9e2 100644 --- a/src/bone.js +++ b/src/bone.js @@ -1307,7 +1307,8 @@ class Bone { instance._setRaw(attribute.name, attribute.cast(value)); instance._setRawSaved(attribute.name, attribute.cast(value)); } else { - if (!isNaN(value)) instance[columnName] = Number(value); + if (value != null && typeof value == 'object') instance[columnName] = value; + else if (!isNaN(value)) instance[columnName] = Number(value); else if (!isNaN(Date.parse(value))) instance[columnName] = new Date(value); else instance[columnName] = value; }