|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
487 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | var eq = require('./eq');
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * Gets the index at which the `key` is found in `array` of key-value pairs.
|
|---|
| 5 | *
|
|---|
| 6 | * @private
|
|---|
| 7 | * @param {Array} array The array to inspect.
|
|---|
| 8 | * @param {*} key The key to search for.
|
|---|
| 9 | * @returns {number} Returns the index of the matched value, else `-1`.
|
|---|
| 10 | */
|
|---|
| 11 | function assocIndexOf(array, key) {
|
|---|
| 12 | var length = array.length;
|
|---|
| 13 | while (length--) {
|
|---|
| 14 | if (eq(array[length][0], key)) {
|
|---|
| 15 | return length;
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 | return -1;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | module.exports = assocIndexOf;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.