Skip to content

Commit ff3f7d6

Browse files
author
Ricardo Gama
committed
Release 2.1.1
1 parent a6ebb51 commit ff3f7d6

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [2.1.1](https://github.com/seegno/bookshelf-json-columns/tree/2.1.1) (2017-07-18)
4+
[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.1.0...2.1.1)
5+
6+
**Merged pull requests:**
7+
8+
- Fix parsing empty strings [\#50](https://github.com/seegno/bookshelf-json-columns/pull/50) ([zhongzhi107](https://github.com/zhongzhi107))
9+
310
## [2.1.0](https://github.com/seegno/bookshelf-json-columns/tree/2.1.0) (2017-03-01)
411
[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.0.1...2.1.0)
512

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exports.default = Bookshelf => {
110110
return Model.save.call(this, attributes, options).then(model => {
111111
// Parse JSON columns.
112112
Object.keys(attributes).forEach(attribute => {
113-
if (this.constructor.jsonColumns.indexOf(attribute) !== -1) {
113+
if (this.constructor.jsonColumns.indexOf(attribute) !== -1 && model.attributes[attribute]) {
114114
model.attributes[attribute] = JSON.parse(model.attributes[attribute]);
115115
}
116116
});
@@ -144,4 +144,4 @@ exports.default = Bookshelf => {
144144
});
145145
};
146146

147-
module.exports = exports['default'];
147+
module.exports = exports['default'];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bookshelf-json-columns",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Parse JSON columns with Bookshelf.js",
55
"license": "MIT",
66
"author": {

0 commit comments

Comments
 (0)