Ghost/core/frontend/services/sitemap/user-generator.js
Hannah Wolfe 526993965a
Switch to @trghost/validator, remove validator
- Part of the effort to split Ghost down into smaller, decoupled pieces
- Moved out our internal validator tooling to a separate library
- Replaced all usage of our own tooling and validatorjs directly with @tryghost/validator
- Removed the validatorjs dependency and removed the renovate pin
- This gives us a consistant, smaller, clearer public API for validations
- It will eventually be used on Ghost Admin too
- This way we can start getting up to date with validator whilst not increasing build size
2021-06-16 08:11:22 +01:00

19 lines
481 B
JavaScript

const _ = require('lodash');
const validator = require('@tryghost/validator');
const BaseMapGenerator = require('./base-generator');
class UserMapGenerator extends BaseMapGenerator {
constructor(opts) {
super();
this.name = 'authors';
_.extend(this, opts);
}
validateImageUrl(imageUrl) {
return imageUrl && validator.isURL(imageUrl, {protocols: ['http', 'https'], require_protocol: true});
}
}
module.exports = UserMapGenerator;