Open nsharrok opened 8 years ago
This PR is related to issue #38 An observer added to the pair-by.js helper allows for dynamic chart updating. addon/helpers/pair-by.js
import Ember from 'ember'; import Helper from 'ember-helper'; import observer from 'ember-metal/observer'; const { assert } = Ember; export default Helper.extend({ compute(params) { assert('pair-by requires at least 2 arguments: key, data', params.length >= 2); let data = params.pop(); this.set('array', data); assert('last argument must be an array of objects', Ember.isArray(data)); let [...keys] = params; return data.map((d) => { return keys.reduce((acc, k, index) => { acc[index] = d[k]; return acc; }, []); }); }, contentDidChange: observer('array.[]', function() { this.recompute(); }) });
This PR doesn't seem to contain the correct commits, the diff is only for some package changes.
This PR is related to issue #38 An observer added to the pair-by.js helper allows for dynamic chart updating. addon/helpers/pair-by.js