mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 01:11:39 +02:00
Add helpers for the reader and int parsing.
This commit is contained in:
parent
3c093c7d51
commit
e4a93da8ea
1 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
||||||
(ns uxbox.util.data
|
(ns uxbox.util.data
|
||||||
"A collection of data transformation utils.")
|
"A collection of data transformation utils."
|
||||||
|
(:require [cljs.reader :as r]))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Data structure manipulation
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defn index-by
|
(defn index-by
|
||||||
"Return a indexed map of the collection
|
"Return a indexed map of the collection
|
||||||
|
@ -17,3 +22,15 @@
|
||||||
pairs when value is `nil`."
|
pairs when value is `nil`."
|
||||||
[data]
|
[data]
|
||||||
(into {} (remove (comp nil? second) data)))
|
(into {} (remove (comp nil? second) data)))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Numbers Parsing
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defn read-string
|
||||||
|
[v]
|
||||||
|
(r/read-string v))
|
||||||
|
|
||||||
|
(defn parse-int
|
||||||
|
[v]
|
||||||
|
(js/parseInt v 10))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue