Ghost/ghost/admin/lib/koenig-editor/addon/helpers/card-is-available.js

23 lines
565 B
JavaScript
Raw Normal View History

import Helper from '@ember/component/helper';
import {get} from '@ember/object';
import {inject as service} from '@ember/service';
export default class CardIsAvailableHelper extends Helper {
@service config;
@service feature;
compute([card]) {
let cardIsAvailable = true;
if (card.developerExperiment) {
cardIsAvailable = this.config.get('enableDeveloperExperiments');
}
if (card.feature) {
cardIsAvailable = get(this.feature, card.feature);
}
return cardIsAvailable;
}
}