Skip to content

Commit

Permalink
* map.head changed to getter
Browse files Browse the repository at this point in the history
* is_valid_data documented
  • Loading branch information
christianschmitz committed Nov 23, 2023
1 parent 68dabc6 commit 48c539b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@hyperionbt/helios": "^0.16.4",
"@hyperionbt/helios": "^0.16.5",
"@jsdoc/ast": "^0.2.1",
"@jsdoc/parse": "^0.3.1",
"helios": "^0.0.5",
Expand Down
15 changes: 8 additions & 7 deletions src/lang/builtins/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ Map[KeyType]ValueType::from_data(data: Data) -> Map[KeyType]ValueType

## Getters

### `head`

Get the key and the value of the first entry.

```helios
map.head -> (KeyType, ValueType)
```

### `head_key`

Returns the key of the first entry in the `Map`. Throws an error if the `Map` is empty.
Expand Down Expand Up @@ -204,13 +212,6 @@ Returns the value of the first entry in the map that matches the given key (wrap
map.get_safe(key: KeyType) -> Option[ValueType]
```

### `head`

Get the key and the value of the first entry.

```helios
map.head() -> (KeyType, ValueType)
```

### `is_empty`

Expand Down
10 changes: 9 additions & 1 deletion src/lang/user-defined-types/methods/automatic-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ MyType::from_data(data: Data) -> MyType

If you set [`CHECK_CASTS`](../../../api/reference/namespaces/config.md#check_casts) to `true`, a warning will be printed if the structure of `data` doesn't match the type.

## `is_valid_data`

Deep check that the given data matches the expected format.

```helios
MyType::is_valid_data(data: Data) -> Bool
```

## `serialize`

The `serialize` method is automatically defined on every user-type, and thus `serialize` is a reserved name that can't be used for other methods.
Expand All @@ -57,4 +65,4 @@ The `show` method returns a string representation of underlying instance, which
my_instance.show() -> String
```

> **Note**: usually you will use `print(x.show())` instead `print(x.serialize().show())` when debugging.
> **Note**: usually you will use `print(x.show())` instead of `print(x.serialize().show())` when debugging.

0 comments on commit 48c539b

Please sign in to comment.