From b4e19344344a31a471e6f095529da858e38f5df4 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 3 Jan 2018 14:58:19 +0800 Subject: [PATCH] update --- dist/fix/fix.compact.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index acc1b692bd..53bdd3bb2b 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -128,6 +128,40 @@ }) : old.apply(this, arguments); }; }); + BI.isEmpty = function (ob) { + if (BI.isPlainObject(ob) && ob.__ob__) { + return BI.keys(ob).length === 0; + } + return _.isEmpty(ob); + }; + BI.keys = function (ob) { + var keys = _.keys(ob); + var nKeys = []; + for (var i = 0; i < keys.length; i++) { + if (!(keys[i] in Fix.$$skipArray)) { + nKeys.push(keys[i]); + } + } + return nKeys; + }; + BI.values = function (ob) { + var keys = BI.keys(obj); + var length = keys.length; + var values = []; + for (var i = 0; i < length; i++) { + values[i] = obj[keys[i]]; + } + return values; + }; + BI.size = function (ob) { + if (BI.isPlainObject(ob) && ob.__ob__) { + return BI.keys(ob).length; + } + return _.size(ob); + }; + BI.isEmptyObject = function (ob) { + return BI.size(ob) === 0; + }; } BI.watch = Fix.watch; }()); \ No newline at end of file