Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/ember-runtime/lib/mixins/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,21 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
},

/**
Returns the index for a particular object in the index.

@param {Object} object the item to search for
@param {NUmber} startAt optional starting location to search, default 0
@returns {Number} index of -1 if not found
Returns the index of the given object's first occurrence,
If no startAt argument is given, the starting location to
search is 0. Returns -1 if no match is found.

@param {Object} object the object to search for
@param {Number} startAt optional starting location to search, default 0
@returns {Number} index or -1 if not found

@example
arr = ["a", "b", "c", "d", "a"];
arr.indexOf("a"); => 0
arr.indexOf("a", 2); => 4
arr.indexOf("z"); => -1
arr.indexOf("b", 3); => -1
arr.indexOf("a", 100); => -1
*/
indexOf: function(object, startAt) {
var idx, len = get(this, 'length');
Expand Down