ember-gather

0.1.1 • Public • Published

ember-gather

A handy pair of macros for computing flattened arrays.

Latest NPM release CircleCI Build Status Code Climate Ember Observer Score Dependencies Dev Dependencies License

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 repository
  • cd ember-gather
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.

Package Sidebar

Install

npm i ember-gather

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • bsipple