Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parse(val) {
if (val instanceof MobxModel) {
return val.toJS();
}
if (Array.isArray(val) || isObservableArray(val)) {
return val.map(item => parse(item));
} else if (
!val ||
is.date(val) ||
is.bool(val) ||
is.fn(val) ||
is.number(val) ||
is.string(val) ||
is.regexp(val)
) {
return val;
} else if (val && typeof val === "object") {
return mapValues(val, item => parse(item));
}
return toJS(val);
}
function stringifyLiteral(value) {
if (is.bool(value)) {
return value ? 'true' : 'false';
} else if (is.string(value)) {
return `"${escape(value)}"`;
}
return String(value);
}
each(group, function(prop, key) {
var value = dot(obj, prop) || obj[prop];
if (is.bool(value)) value = value.toString();
if (value || value === 0) ret[key] = value;
});
});
if (value instanceof BigQuery.date) {
typeName = 'DATE';
} else if (value instanceof BigQuery.datetime) {
typeName = 'DATETIME';
} else if (value instanceof BigQuery.time) {
typeName = 'TIME';
} else if (value instanceof BigQuery.timestamp) {
typeName = 'TIMESTAMP';
} else if (value instanceof Buffer) {
typeName = 'BYTES';
} else if (is.array(value)) {
return {
type: 'ARRAY',
arrayType: BigQuery.getType_(value[0])
};
} else if (is.bool(value)) {
typeName = 'BOOL';
} else if (is.number(value)) {
typeName = value % 1 === 0 ? 'INT64' : 'FLOAT64';
} else if (is.object(value)) {
return {
type: 'STRUCT',
structTypes: Object.keys(value).map(function(prop) {
return {
name: prop,
type: BigQuery.getType_(value[prop])
};
})
};
} else if (is.string(value)) {
typeName = 'STRING';
}
var isScalar = function (value) {
return !value || is.string(value) || is.number(value) || is.bool(value);
};
page(isEnabledOrOptions = true) {
if (is.bool(isEnabledOrOptions)) {
this.pageOptions = { isEnabled: isEnabledOrOptions }
} else {
this.pageOptions = {
...isEnabledOrOptions,
isEnabled:
isEnabledOrOptions.isEnabled !== undefined
? isEnabledOrOptions.isEnabled
: true,
}
}
return this
}
each(group, function(prop, key) {
var value = dot(obj, prop) || obj[prop];
if (is.bool(value)) value = value.toString();
if (value || value === 0) ret[key] = value;
});
});