File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -9898,7 +9898,8 @@ Maps become Objects. Arbitrary keys are encoded to by key->js."
9898
9898
(defn- demunge-str [munged-name]
9899
9899
(let [r (js/RegExp. (demunge-pattern ) " g" )
9900
9900
munged-name (if (gstring/endsWith munged-name " $" )
9901
- (.substring munged-name 0 (dec (. munged-name -length))))]
9901
+ (.substring munged-name 0 (dec (. munged-name -length)))
9902
+ munged-name)]
9902
9903
(loop [ret " " last-match-end 0 ]
9903
9904
(if-let [match (.exec r munged-name)]
9904
9905
(let [[x] match]
Original file line number Diff line number Diff line change 32
32
[ns-sym]
33
33
(string/replace (ana/munge-path ns-sym) \. \/))
34
34
35
+ (defn file->ns
36
+ [file]
37
+ (let [lib-name (subs (string/replace file " /" " ." )
38
+ 0 (- (count file) 5 ))]
39
+ (symbol (demunge lib-name))))
40
+
35
41
(defn atom? [x]
36
42
(instance? Atom x))
37
43
Original file line number Diff line number Diff line change 2875
2875
arguments)))
2876
2876
[])))
2877
2877
2878
+ (deftest test-munge-demunge
2879
+ (is (= 'cljs.core/first?
2880
+ (demunge (munge 'cljs.core/first?)))))
2881
+
2878
2882
(comment
2879
2883
; ; ObjMap
2880
2884
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments