UNPKG
imma
Version:
latest (0.0.1)
0.0.1
A collection of functions for dealing with native arrays and objects immutably
imma
/
lib
/
general
/
hasIn.js
8 lines
(7 loc)
•
237 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
'use strict'
const
hasIn =
module
.
exports
=
(
iterable, keys
) =>
{
const
first = keys[
0
]
if
(!iterable || !(first
in
iterable))
return
false
if
(keys.
length
===
1
)
return
true
return
hasIn
(iterable[first], keys.
slice
(
1
)) }