Not sure if I'm missing something, but wouldn't it be trivial to code that constructor in JS?
```js class Result { constructor (type, value=true) { this[type] = value; } } function add(data) { if (data !== Object(data)) { return new Result('error', new Error('The data is not an object.')); } return new Result('success'); } console.log(add({}).success); // true console.log(add(12).error.message); // 'The data is not an object.' ```
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss