ember-gather
v0.1.1
Published
A handy pair of macros for computing flattened arrays
Maintainers
Readme
ember-gather
A handy pair of macros for computing flattened arrays.
Usage
Use gather when you just need to flatten the top-level value of each property into a list:
import { gather } from 'ember-gather';
import Component from 'ember-component';
export default Component.extend({
terrestrials: ['Mercury', 'Venus', 'Earth', 'Mars'],
gasGiants: ['Jupiter', 'Saturn', 'Neptune', 'Uranus'],
planets: gather('terrestrials', 'gasGiants') // => ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Neptune', 'Uranus']
});
Use deepGather when you need to flatten all items within all values of each property into a list:
import { deepGather } from 'ember-gather';
import Component from 'ember-component';
const planets = [
['Mercury', 'Venus', 'Earth', 'Mars'],
['Jupiter', 'Saturn', 'Neptune', 'Uranus']
];
const dwarfPlanets = ['Pluto', 'Ceres', 'Eris', 'Haumes', 'MakeMake'];
export default Component.extend({
planets,
dwarfPlanets,
planetaryBodies: deepGather('planets', 'dwarfPlanets') // => ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Neptune', 'Uranus', 'Pluto', 'Ceres', 'Eris', 'Haumes', 'MakeMake']
});
Developing
git clone <repository-url>this repositorycd ember-gathernpm installbower install
Running
ember serve- Visit your app at http://localhost:4200.
Running Tests
npm test(Runsember try:eachto test your addon against multiple Ember versions)ember testember test --server
Building
ember build
For more information on using ember-cli, visit http://ember-cli.com/.
