ember-cli-array-limit

1.0.0 • Public • Published

ember-cli-array-limit

master branch build status

Ember CLI array limit addon.

ember-cli-array-limit exposes an Ember ArrayProxy subclass which returns only the content array items before a certain limit.

Example

import Ember from 'ember';
import ArrayLimit from 'array-limit';
 
var arr = Ember.A(['a', 'b', 'c', 'd', 'e', 'f']);
var proxy = ArrayLimit.create({
    content: arr,
    limit: 3
});
 
console.log(proxy.toArray()); // ['a', 'b', 'c']
proxy.incrementProperty('limit');
console.log(proxy.toArray()); // ['a', 'b', 'c', 'd']
arr.unshiftObject('x');
console.log(proxy.toArray()); // ['x', 'a', 'b', 'c']

Properties

content: Ember.Array (optional, default = null)

The content array. Must be an object that implements Ember.Array and/or Ember.MutableArray. See Ember.ArrayProxy#content.

limit: Number (optional, default = Infinity)

This value determines the maximum number of elements to allow.

Installing

With npm:

$ npm install --save-dev ember-cli-array-limit

Or with Ember CLI:

$ ember install ember-cli-array-limit

License

MIT license.

Readme

Keywords

Package Sidebar

Install

npm i ember-cli-array-limit

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • j-