mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 23:31:21 -05:00
🎉 Backport pprint module to common
This commit is contained in:
parent
caa81b4fe2
commit
7b3ab2287a
1 changed files with 26 additions and 0 deletions
26
common/src/app/common/pprint.cljc
Normal file
26
common/src/app/common/pprint.cljc
Normal file
|
@ -0,0 +1,26 @@
|
|||
;; 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) UXBOX Labs SL
|
||||
|
||||
(ns app.common.pprint
|
||||
(:refer-clojure :exclude [prn])
|
||||
(:require
|
||||
[fipp.edn :as fpp]))
|
||||
|
||||
(defn pprint-str
|
||||
[expr]
|
||||
(binding [*print-level* 8
|
||||
*print-length* 25]
|
||||
(with-out-str
|
||||
(fpp/pprint expr {:width 110}))))
|
||||
|
||||
(defn pprint
|
||||
([expr]
|
||||
(println (pprint-str expr)))
|
||||
([label expr]
|
||||
(println (str "============ " label "============"))
|
||||
(pprint expr)))
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue