mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-30 00:50:58 +03:00
Adds helpers for validating untrusted scene data: - `isRecord`: a non-null, non-array object whose keys can be read - `toFiniteNumber`: accepts finite numbers and strings that are entirely a number (optionally with a `px` suffix). The regex is anchored so that e.g. dates or lists of numbers aren't truncated to their leading number, and is unambiguous so that it runs in linear time on untrusted input. - `toPositiveNumber`: same, restricted to values > 0 `restoreFreedrawStrokeOptions` uses `isRecord` in place of its inline check. Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
@excalidraw/common
Install
npm install @excalidraw/common
If you prefer Yarn over npm, use this command to install the Excalidraw utils package:
yarn add @excalidraw/common
With PNPM, similarly install the package with this command:
pnpm add @excalidraw/common