penpot/common/src/app/common/pprint.cljc
2023-11-27 14:25:12 +01:00

23 lines
623 B
Clojure

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.common.pprint
(:refer-clojure :exclude [prn])
(:require
[me.flowthing.pp :as pp]))
(defn pprint
[expr & {:keys [width level length]
:or {width 120 level 8 length 25}}]
(binding [*print-level* level
*print-length* length]
(pp/pprint expr {:max-width width})))
(defn pprint-str
[expr & {:as opts}]
(with-out-str
(pprint expr opts)))