mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
14 lines
418 B
JavaScript
14 lines
418 B
JavaScript
|
var when = require('when'),
|
||
|
_ = require('lodash'),
|
||
|
utils;
|
||
|
|
||
|
utils = {
|
||
|
checkObject: function (object, docName) {
|
||
|
if (_.isEmpty(object) || _.isEmpty(object[docName]) || _.isEmpty(object[docName][0])) {
|
||
|
return when.reject({type: 'BadRequest', message: 'No root key (\'' + docName + '\') provided.'});
|
||
|
}
|
||
|
return when.resolve(object);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = utils;
|