From ff3f7d699cf54685a7bd2252ebfd6a057a4600fa Mon Sep 17 00:00:00 2001 From: Ricardo Gama Date: Tue, 18 Jul 2017 11:01:54 +0100 Subject: [PATCH] Release 2.1.1 --- CHANGELOG.md | 7 +++++++ dist/index.js | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b29ef..d9ac0be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.1.1](https://github.com/seegno/bookshelf-json-columns/tree/2.1.1) (2017-07-18) +[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.1.0...2.1.1) + +**Merged pull requests:** + +- Fix parsing empty strings [\#50](https://github.com/seegno/bookshelf-json-columns/pull/50) ([zhongzhi107](https://github.com/zhongzhi107)) + ## [2.1.0](https://github.com/seegno/bookshelf-json-columns/tree/2.1.0) (2017-03-01) [Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.0.1...2.1.0) diff --git a/dist/index.js b/dist/index.js index 933036f..79b8e1a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -110,7 +110,7 @@ exports.default = Bookshelf => { return Model.save.call(this, attributes, options).then(model => { // Parse JSON columns. Object.keys(attributes).forEach(attribute => { - if (this.constructor.jsonColumns.indexOf(attribute) !== -1) { + if (this.constructor.jsonColumns.indexOf(attribute) !== -1 && model.attributes[attribute]) { model.attributes[attribute] = JSON.parse(model.attributes[attribute]); } }); @@ -144,4 +144,4 @@ exports.default = Bookshelf => { }); }; -module.exports = exports['default']; +module.exports = exports['default']; \ No newline at end of file diff --git a/package.json b/package.json index 4ea1131..045bfd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bookshelf-json-columns", - "version": "2.1.0", + "version": "2.1.1", "description": "Parse JSON columns with Bookshelf.js", "license": "MIT", "author": {