From b1ec3ba748dc7b58015e97448958e78b512f6df0 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 2 Jan 2017 11:05:36 +0800 Subject: Refactor data processing to model definition --- lib/models/index.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/models/index.js') diff --git a/lib/models/index.js b/lib/models/index.js index 6d0fd3c3..e83956e5 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -27,6 +27,12 @@ function stripNullByte(value) { } sequelize.stripNullByte = stripNullByte; +function processData(data, _default, process) { + if (data === undefined) return data; + else return data === null ? _default : (process ? process(data) : data); +} +sequelize.processData = processData; + var db = {}; fs -- cgit v1.2.3