import Component from '@glimmer/component'; import { action } from '@ember/object'; export default class BookComponent extends Component { get bookTitle() { let string = this.args.book.name.toLowerCase(); if (this.isNumber(string.charAt(0))) { return string.slice(0,1) + string.charAt(2).toUpperCase() + string.slice(3); } else { return string.charAt(0).toUpperCase() + string.slice(1); } } @action selectBook() { this.args.showChapters(this.args.book); } isNumber(char) { var number = /^[0-9]+$/; let string = char; if(string.match(number)) { return true; } else { return false; } } }