UNPKG
@smarterlabs/norman
Version:
latest (0.6.4)
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.1
0.1.0
A static data layer for modern web applications
github.com/smarterlabs/norman
smarterlabs/norman
@smarterlabs/norman
/
src
/
find-by-uid.js
13 lines
(11 loc)
•
248 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
const
get
= require(`lodash/
get
`) function findByUID(arr,
data
, uidPath){ let uid =
get
(
data
, uidPath)
for
(let index = arr.length; index--;){
if
(
get
(arr[index], uidPath) == uid){
return
index } }
return
-
1
} module.exports = findByUID