Files
kredits-web/app/utils/cps/bignumber.js
T
bumi 32846194b6 Handle bignumber conversions
The kredits module always returns raw data from the contract. For uint
values these are bignumbers.
To handle those in the ember app we need to convert them to string or to
number.
2018-04-09 20:31:34 +02:00

14 lines
320 B
JavaScript

import computed from 'ember-computed';
export default function(dependentKey, converterMethod) {
return computed(dependentKey, {
get () {
return this.get(dependentKey)[converterMethod]();
},
set (key, value) {
this.set(dependentKey, value);
return value[converterMethod]();
}
});
}