vault backup: 2025-03-24 22:40:31
All checks were successful
Update pages on webserver / Update (push) Successful in 5s
All checks were successful
Update pages on webserver / Update (push) Successful in 5s
This commit is contained in:
parent
620bd29a29
commit
2fb9fb3e36
@ -6,7 +6,7 @@ While working on my Database datapack (still WIP), I knew I'd want to find
|
||||
|
||||
# Scenario
|
||||
## Dataset
|
||||
The data is stored in a storage `#_macro.array`. Array is populated with a total of 500 entries, each having a `id` and `string` fields.
|
||||
The data is stored in a storage `#_macro.array`. Array is populated with a total of 500 entries, each having `id` and `string` fields.
|
||||
```json
|
||||
[
|
||||
{
|
||||
@ -21,8 +21,17 @@ The data is stored in a storage `#_macro.array`. Array is populated with a total
|
||||
]
|
||||
```
|
||||
## Constraints
|
||||
The objective is to create an interface that receives a keyword, say `entry500`, and searches the array for an entry where the value of `string` matches the keyword.
|
||||
The objective is to create an interface that receives a keyword, say `entry500`, and searches `#_macro.array` for an entry where the value of `string` matches the keyword. The keyword
|
||||
|
||||
In TypeScript, it would look something like this:
|
||||
```ts
|
||||
function searchArray(keyword: string) {
|
||||
// logic
|
||||
return theRelevantEntry
|
||||
}
|
||||
|
||||
searchArray('entry500')
|
||||
```
|
||||
# One Macro
|
||||
Macros allow us to reach into our array and pick out an entry that matching value in the `string` property.
|
||||
```vb
|
||||
|
||||
Loading…
Reference in New Issue
Block a user