rubico
Version:
[a]synchronous functional programming
28 lines (24 loc) • 567 B
JavaScript
/**
* Rubico v2.8.2
* https://rubico.land/
*
* © Richard Yufei Tong, King of Software
* Rubico may be freely distributed under the CFOSS license.
*/
// (object Object, key string) -> boolean
const objectHas = function (object, key) {
return object[key] != null
}
const has = key => function hasKey(container) {
if (container == null) {
return false
}
if (typeof container.has == 'function') {
return container.has(key)
}
if (container.constructor == Object) {
return objectHas(container, key)
}
return false
}
export default has