|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
408 bytes
|
| Line | |
|---|
| 1 | define(['./_cb', './keys'], function (_cb, keys) {
|
|---|
| 2 |
|
|---|
| 3 | // Returns the first key on an object that passes a truth test.
|
|---|
| 4 | function findKey(obj, predicate, context) {
|
|---|
| 5 | predicate = _cb(predicate, context);
|
|---|
| 6 | var _keys = keys(obj), key;
|
|---|
| 7 | for (var i = 0, length = _keys.length; i < length; i++) {
|
|---|
| 8 | key = _keys[i];
|
|---|
| 9 | if (predicate(obj[key], key, obj)) return key;
|
|---|
| 10 | }
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | return findKey;
|
|---|
| 14 |
|
|---|
| 15 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.