UNPKG
homee-api
Version:
latest (0.24.4)
0.24.4
0.24.3
0.24.2
0.24.1
0.24.0
0.23.0
0.22.0
0.21.1
0.21.0
0.20.0
0.19.0
0.18.0
0.17.0
0.16.0
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.0
0.13.0
0.12.0
0.11.1
0.11.0
0.10.0
0.9.8
0.9.7
0.9.6
0.9.5
0.9.3
0.9.2
0.9.1
a library to interact with homee
github.com/stfnhmplr/homee-api
stfnhmplr/homee-api
homee-api
/
lib
/
helpers.js
12 lines
(10 loc)
•
214 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
module
.
exports
= {
updateList
:
(
list, obj
) =>
{
const
objIndex = list.
findIndex
(
(
o
) =>
o.
id
=== obj.
id
);
if
(objIndex > -
1
) { list[objIndex] = obj; }
else
{ list.
push
(obj); } }, };