mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 09:22:49 +03:00
35f150bcf4
no-issue More cleanup to pull files into their appropriate responsibility
19 lines
592 B
JavaScript
19 lines
592 B
JavaScript
const ValueObject = require('./shared/ValueObject');
|
|
const InvalidOfferCurrency = require('../errors').InvalidOfferCurrency;
|
|
|
|
/** @extends ValueObject<string> */
|
|
class OfferCurrency extends ValueObject {
|
|
/** @param {unknown} currency */
|
|
static create(currency) {
|
|
if (typeof currency !== 'string') {
|
|
throw new InvalidOfferCurrency({
|
|
message: 'Offer `currency` must be a string.'
|
|
});
|
|
}
|
|
// TODO: Validate it is a country code we support?
|
|
return new OfferCurrency(currency);
|
|
}
|
|
}
|
|
|
|
module.exports = OfferCurrency;
|