all files / app/macros/ to-number.js

100% Statements 5/5
50% Branches 2/4
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12        32× 32×        
import computed from 'ember-computed'
 
 
 
export default function toNumberMacro (stringPropertyName, base = 10) {
  return computed(stringPropertyName, function () {
    const value = this.get(stringPropertyName)
    return parseInt(value, base)
  })
}