简体   繁体   English

Firebase Function onCall 中“数据”的数据类型 function

[英]Firebase Function Data Type of "data" in onCall function

I thought i had a simple question but it seems to be somewhat harder and the documentation does not help alot.我以为我有一个简单的问题,但它似乎有点难,而且文档也无济于事。

What exactly is the type of 'data' in "functions.https.onCall((data, context) {});" “functions.https.onCall((data, context) {});”中“数据”的类型到底是什么?

I thought it varies between a simple value, a map or a list.我认为它在简单值、map 或列表之间变化。 But even if i call the function with a map object and try to delete a key from it, it fails because it isn't a map.但即使我用 map object 调用 function 并尝试从中删除一个密钥,它也会失败,因为它不是 map。

It also can't be immutable and casting it to a map doesn't work too.它也不能是不可变的,将它转换为 map 也不起作用。

So whatever it is, i just want to remove a key from it.所以不管它是什么,我只想从中删除一把钥匙。 Does anyone know the datatype so i am able to find the correct function?有谁知道数据类型,所以我能够找到正确的 function?

As @Delwinn stated out, the 'data' object seems to be a 'json object' (if this is a type in typescript) and not a map.正如@Delwinn 所述,“数据”object 似乎是一个“json 对象”(如果这是打字稿中的类型)而不是 map。

to delete a value from this object, a plain line like从这个 object 中删除一个值,像这样的普通行

delete json[key]

will do the job.会做的工作。 And yes, 'delete' is written like an operator and not a function.是的,'delete' 的写法类似于运算符,而不是 function。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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