# decodeShapes

Reads shapes written by [`encodeShapes`](https://docs.mapcairn.com/api/core/encodeShapes.md). Text from a link is hostile
until proven otherwise, so it is checked before anything is read: only the
link-safe alphabet, at most [`MAX_SHARE_LENGTH`](https://docs.mapcairn.com/api/core/MAX_SHARE_LENGTH.md) characters and
[`MAX_SHARE_SHAPES`](https://docs.mapcairn.com/api/core/MAX_SHARE_SHAPES.md) shapes, numbers of at most seven characters and
positions inside the world. The work done is linear in the text.

This is a function exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import { decodeShapes } from "@mapcairn/core";
 
function decodeShapes(text: string): DrawShapeInput[] | null;
```

## Parameters

- `text` (`string`)

## Returns

`DrawShapeInput[] | null`: The shapes, or null when the text is not made of the link-safe
 alphabet, is too long or holds too many shapes, or holds no valid shape.
 A shape that cannot be read or that fails the draw rules (a polygon of
 two positions, a circle with a radius of 0, crossing edges, a position
 outside the world) is skipped on its own and the rest kept.

## See also

- [`DrawShapeInput`](https://docs.mapcairn.com/api/core/DrawShapeInput.md)

Source: [packages/core/src/draw/share.ts:249](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/draw/share.ts#L249)
