Skip to content

Commit

Permalink
Export default instead of make
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Aug 17, 2023
1 parent f863533 commit 8a8118d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/emotion-hash/hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ let murmur2 (str : string) =
(* (h ^ (h >>> 15)) >>> 0 *)
!hash ^ (!hash >>> 15) >>> 0

let make (str : string) = str |> murmur2 |> to_css
let default (str : string) = str |> murmur2 |> to_css
2 changes: 1 addition & 1 deletion packages/emotion-hash/hash.mli
Original file line number Diff line number Diff line change
@@ -1 +1 @@
val make : string -> string
val default : string -> string
2 changes: 1 addition & 1 deletion packages/emotion-hash/js.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let default = Emotion_hash.Hash.make
include Emotion_hash.Hash
6 changes: 3 additions & 3 deletions packages/emotion/native/shared/Css.ml
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,18 @@ let style (styles : rule list) =
match List.find_map is_label styles with
| None ->
let prefix = "css" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
let hash = Emotion_hash.Hash.default (rules_to_string styles) in
append (Printf.sprintf "%s-%s" prefix hash) styles;
hash
| Some label ->
let prefix = "css" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
let hash = Emotion_hash.Hash.default (rules_to_string styles) in
append (Printf.sprintf "%s-%s-%s" prefix hash label) styles;
hash

let style_debug (styles : rule list) =
print_endline (rules_to_string styles);
let hash = Emotion_hash.Hash.make (rules_to_string styles) |> String.cat "css-" in
let hash = Emotion_hash.Hash.default (rules_to_string styles) |> String.cat "css-" in
append hash styles;
hash

Expand Down
6 changes: 3 additions & 3 deletions packages/emotion/native/shared/CssJs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,18 @@ let style (styles : rule array) =
match Array.find_map is_label styles with
| None ->
let prefix = "css" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
let hash = Emotion_hash.Hash.default (rules_to_string styles) in
append (Printf.sprintf "%s-%s" prefix hash) styles;
hash
| Some label ->
let prefix = "css" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
let hash = Emotion_hash.Hash.default (rules_to_string styles) in
append (Printf.sprintf "%s-%s-%s" prefix hash label) styles;
hash

let style_debug (styles : rule array) =
print_endline (rules_to_string styles);
let hash = Emotion_hash.Hash.make (rules_to_string styles) |> String.cat "css-" in
let hash = Emotion_hash.Hash.default (rules_to_string styles) |> String.cat "css-" in
append hash styles;
hash

Expand Down
2 changes: 1 addition & 1 deletion packages/emotion/test/test_css_hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let check_equality (input, expected) =
fun () ->
(Alcotest.check Alcotest.string)
(quoted input ^ " should hash")
expected (Hash.make input) )
expected (Hash.default input) )

let data =
[
Expand Down

0 comments on commit 8a8118d

Please sign in to comment.