decodeShapes
Reads shapes written by encodeShapes. 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 characters and
MAX_SHARE_SHAPES 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
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.