switched uses of 'typeof obj === object' to use _.isObject in order to promote proper handling of null values

This commit is contained in:
Spencer Alger 2014-05-05 17:46:09 -07:00
parent de542320bf
commit 83ce9ffc22
3 changed files with 5 additions and 9 deletions

View file

@ -43,11 +43,7 @@ define(function (require) {
indexish = indexish.get('index');
}
return Promise.cast(
(typeof indexish === 'object')
? indexish
: indexPatterns.get(indexish)
)
return Promise.cast(_.isObject(indexish) ? indexish : indexPatterns.get(indexish))
.then(function (indexPattern) {
return indexPattern.fields;
});

View file

@ -185,8 +185,8 @@ define(function (require) {
if (
rowsPerTick === void 0
&& typeof window.performance === 'object'
&& typeof performance.now === 'function'
&& window.performance
&& typeof window.performance.now === 'function'
) {
timing = performance.now();
rowsPerTick = 30;
@ -366,7 +366,7 @@ define(function (require) {
val = (val == null) ? '' : val;
// stringify array's and objects
if (typeof val === 'object') val = JSON.stringify(val);
if (_.isObject(val)) val = JSON.stringify(val);
// truncate
if (typeof val === 'string' && val.length > $scope.maxLength) {

View file

@ -32,7 +32,7 @@ define(function (require) {
_.keys(obj).forEach(function (key) {
stack.push(key);
if (typeof keepArrays && _.isArray(obj[key])) flatObj[stack.join(dot)] = obj[key];
else if (typeof obj[key] === 'object') flattenObj(obj[key]);
else if (_.isObject(obj[key])) flattenObj(obj[key]);
else flatObj[stack.join(dot)] = obj[key];
stack.pop();
});