* Set categories
(categories)
| 405 | * Set categories |
| 406 | */ |
| 407 | setCategories(categories) { |
| 408 | let allElementsAreStrings = (propertyName, value) => { |
| 409 | if (!Array.isArray(value) || !value.every(item => typeof item === 'string')) { |
| 410 | throw new Error('Array of strings expected for `' + propertyName + '`'); |
| 411 | } |
| 412 | }; |
| 413 | |
| 414 | if (typeof categories === 'string') { |
| 415 | categories = [categories]; |
| 416 | } |
| 417 | |
| 418 | if (this._checkProperty('categories', categories, [this._checkUndefined, allElementsAreStrings])) { |
| 419 | this.categories = categories; |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Add category |
no test coverage detected