mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
e9d6f61029
refs: https://github.com/TryGhost/Ghost/commit/11867ab43
- These checks live in the wrong place. They are mostly a frontend thing
- The only server place they were used was slack and that was fixed in 11867ab43
- Moving these to the frontend they fit neatly into the frontend data service
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
function isPost(jsonData) {
|
|
return Object.prototype.hasOwnProperty.call(jsonData, 'html') &&
|
|
Object.prototype.hasOwnProperty.call(jsonData, 'title') && Object.prototype.hasOwnProperty.call(jsonData, 'slug');
|
|
}
|
|
|
|
function isTag(jsonData) {
|
|
return Object.prototype.hasOwnProperty.call(jsonData, 'name') && Object.prototype.hasOwnProperty.call(jsonData, 'slug') &&
|
|
Object.prototype.hasOwnProperty.call(jsonData, 'description') && Object.prototype.hasOwnProperty.call(jsonData, 'feature_image');
|
|
}
|
|
|
|
function isUser(jsonData) {
|
|
return Object.prototype.hasOwnProperty.call(jsonData, 'bio') && Object.prototype.hasOwnProperty.call(jsonData, 'website') &&
|
|
Object.prototype.hasOwnProperty.call(jsonData, 'profile_image') && Object.prototype.hasOwnProperty.call(jsonData, 'location');
|
|
}
|
|
|
|
function isNav(jsonData) {
|
|
return Object.prototype.hasOwnProperty.call(jsonData, 'label') && Object.prototype.hasOwnProperty.call(jsonData, 'url') &&
|
|
Object.prototype.hasOwnProperty.call(jsonData, 'slug') && Object.prototype.hasOwnProperty.call(jsonData, 'current');
|
|
}
|
|
|
|
module.exports = {
|
|
isPost,
|
|
isTag,
|
|
isUser,
|
|
isNav
|
|
};
|