From 158cfd162497051d8fd7ec508c1074e6fadd7951 Mon Sep 17 00:00:00 2001 From: Iddan Aaronsohn Date: Thu, 22 Sep 2022 20:42:14 +0300 Subject: [PATCH] Add type definitions --- json-truncate.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 json-truncate.d.ts diff --git a/json-truncate.d.ts b/json-truncate.d.ts new file mode 100644 index 0000000..1999858 --- /dev/null +++ b/json-truncate.d.ts @@ -0,0 +1,17 @@ +export type Options = { + /** The max depth to build. */ + maxDepth?: number; + /** What to replace the truncated reference to. */ + replace?: unknown; + curDepth?: number; +}; + +/** + * Truncates variables. + * @param obj The object to truncate. + * @param options If a number, the maxDepth, otherwise configurable options. + * @returns The truncated object. + */ +declare function truncate(obj: T, options?: Options | number): T; + +export default truncate;