UNPKG

@daphneb/phonereporting

Version:

27 lines (25 loc) 743 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var ArrayifyMixin = { componentWillMount: function componentWillMount() { this._arrayify(this.props); }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { this._arrayify(nextProps); }, _arrayify: function _arrayify(props) { if (props.data === null) { this._data = [{ label: 'No data available', values: [{ x: 'No data available', y: 1 }] }]; } else if (!Array.isArray(props.data)) { this._data = [props.data]; } else { this._data = props.data; } } }; exports.default = ArrayifyMixin;