Continuing the discussion from Insert multiple entries with Map/Do/Lambda:
Hello, I’m trying to do what in ES6+ would be called “rest” or “object destructuring” within a Map
/ Lambda
. Each object in the array of objects I’m passing into the Map already has every parameter I want to show up within the Lambda, without renaming. I’m looking at the Select
function, which seems like it’ll do what I want, but I’m left wondering:
Do I really need to do a Select
on each and every parameter I want to pass into the Lambda
?
I have this working, but it seems way more verbose than what I’m used in modern JavaScript. Is there something ridiculously simple I’m missing about FQL, or is this as concise as it gets?
Map([{
offsetX: 1,
offsetY: 2,
offsetXDistance: 2.5,
offsetYDistance: 5,
lat: 37.53369299218995,
lng: -122.1521590561063
},
{
offsetX: 2,
offsetY: 2,
offsetXDistance: 5,
offsetYDistance: 5,
lat: 37.53369299218995,
lng: -122.1065751122126
}
],
Lambda(
"sample",
Create(Collection("LocationSamples"), {
data: {
offsetX: Select("offsetX", Var("sample")),
offsetY: Select("offsetY", Var("sample")),
offsetXDistance: Select("offsetXDistance", Var("sample")),
offsetYDistance: Select("offsetYDistance", Var("sample")),
lat: Select("lat", Var("sample")),
lng: Select("lng", Var("sample")),
}
})
)
)