简体   繁体   中英

firebase-admin node sdk: Why admin.database is both a function and property?

在firebase-admin sdk中,没有人知道如何/为什么可以将admin.database作为函数admin.database()和属性/命名空间(即admin.database.ServerValue吗?

In JavaScript, functions can have properties.

> function x() {}
undefined
> x
[Function: x]
> x.prop = 1
1
> x
{ [Function: x] prop: 1 }
>

Credit goes to Doug Stevenson for pointing it out to me on the firebase slack channel. Thanks Doug!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM