ember-cli-array-slice

Ember CLI array slice addon

Usage no npm install needed!

<script type="module">
  import emberCliArraySlice from 'https://cdn.skypack.dev/ember-cli-array-slice';
</script>

README

ember-cli-array-slice

master branch build status

Ember CLI array slice addon.

ember-cli-array-slice exposes an Ember ArrayProxy subclass which proxies a slice of a given content array. Its values will update when the original array is modified.

Example

import ArraySlice from 'array-slice';

var sliced = ArraySlice.create({
    content: [3, 1, 4, 1, 5, 9],
    offset: 2,
    limit: 3
});

console.log(sliced.toArray()); // [4, 1, 5];

Properties

content: Ember.Array (optional, default = [])

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

offset: Number (optional, default = 0)

Index where slice begins.

limit: Number (optional, default = Infinity)

Maximum number of elements to hold in the array. By default, holds all elements after offset.

Installing

With npm:

$ npm install --save ember-cli-array-slice

Or with Ember CLI:

$ ember install:npm ember-cli-array-slice

License

MIT license.