Merge branch 'Rooyca:master' into master

This commit is contained in:
Linc 2025-01-19 11:13:58 +08:00 committed by GitHub
commit fcf72913ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 3 deletions

View file

@ -128,6 +128,24 @@ show: {0-2-1} -> address -> city
```
~~~
You can access the last element using `{-1}`...
~~~markdown
```req
url:https://api.modrinth.com/v2/project/distanthorizons
show: game_versions -> {-1}
```
~~~
... or get the length of the array using `{len}`.
~~~markdown
```req
url:https://api.modrinth.com/v2/project/distanthorizons
show: game_versions -> {len}
```
~~~
To access multiple elements at the same time when using `{..}` use `&` to separate the keys and use `.` to access the values.
~~~markdown

View file

@ -128,6 +128,24 @@ show: {0-2-1} -> address -> city
```
~~~
Puedes acceder al último elemento usando `{-1}`...
~~~markdown
```req
url:https://api.modrinth.com/v2/project/distanthorizons
show: game_versions -> {-1}
```
~~~
... o obtener la cantidad de elementos usando `{len}`.
~~~markdown
```req
url:https://api.modrinth.com/v2/project/distanthorizons
show: game_versions -> {len}
```
~~~
To access multiple elements at the same time when using `{..}` use `&` to separate the keys and use `.` to access the values.
~~~markdown

View file

@ -1,7 +1,7 @@
{
"id": "api-request",
"name": "APIRequest",
"version": "1.4.4",
"version": "1.4.5",
"minAppVersion": "0.15.0",
"description": "Fetch data from APIs or other sources. Responses in JSON, MD or HTML directly in your notes.",
"author": "rooyca",

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "api-request",
"version": "1.4.4",
"version": "1.4.5",
"lockfileVersion": 3,
"requires": true,
"packages": {

View file

@ -1,6 +1,6 @@
{
"name": "api-request",
"version": "1.4.4",
"version": "1.4.5",
"description": "Fetch data from APIs or other sources. Responses in JSON, MD or HTML directly in your notes.",
"main": "main.js",
"scripts": {

View file

@ -337,6 +337,10 @@ export default class MainAPIR extends Plugin {
} else {
el.createEl("strong", { text: "Error: {..} used on non-array element" });
}
} else if (part == "{-1}") {
result = current[current.length - 1]
} else if (part == "{len}") {
result = current.length.toString()
} else if (part === "{gk}") {
Object.keys(current).forEach((key) => {
traverse(key, idx + 1);