2017-09-24 00:06:29 +00:00
|
|
|
export default function possibleConstructorReturn(self, call) {
|
2017-09-17 08:54:22 +00:00
|
|
|
if (!self) {
|
2017-10-07 04:02:02 +00:00
|
|
|
throw new ReferenceError(
|
2018-03-27 18:51:26 +00:00
|
|
|
"this hasn't been initialised - super() hasn't been called",
|
2017-10-07 04:02:02 +00:00
|
|
|
)
|
2017-09-17 08:54:22 +00:00
|
|
|
}
|
|
|
|
|
2017-10-07 04:02:02 +00:00
|
|
|
return call && (typeof call === 'object' || typeof call === 'function')
|
|
|
|
? call
|
|
|
|
: self
|
|
|
|
}
|