Browse Source

Remove copied code

Oleksandr Naumov 4 years ago
parent
commit
e19f5bf3de
1 changed files with 1 additions and 13 deletions
  1. 1 13
      src/nitro.erl

+ 1 - 13
src/nitro.erl

@@ -29,19 +29,7 @@ jse(X) -> js_escape(X).
 hte(X) when is_binary(X) -> nitro:to_binary(nitro_conv:html_encode(X));
 hte(X) when is_binary(X) -> nitro:to_binary(nitro_conv:html_encode(X));
 hte(X) -> nitro_conv:html_encode(X).
 hte(X) -> nitro_conv:html_encode(X).
 
 
-js_escape(undefined) -> [];
-js_escape(Value) when is_list(Value) -> binary_to_list(js_escape(iolist_to_binary(Value)));
-js_escape(Value) -> js_escape(Value, <<>>).
-js_escape(<<"\\", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "\\\\">>);
-js_escape(<<"\r", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "\\r">>);
-js_escape(<<"\n", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "\\n">>);
-js_escape(<<"\"", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "\\\"">>);
-js_escape(<<"'",Rest/binary>>,Acc) -> js_escape(Rest, <<Acc/binary, "\\'">>);
-js_escape(<<"`",Rest/binary>>,Acc) -> js_escape(Rest, <<Acc/binary, "\\`">>);
-js_escape(<<"<script", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "<scr\" + \"ipt">>);
-js_escape(<<"script>", Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, "scr\" + \"ipt>">>);
-js_escape(<<C, Rest/binary>>, Acc) -> js_escape(Rest, <<Acc/binary, C>>);
-js_escape(<<>>, Acc) -> Acc.
+js_escape(Value) -> nitro_conv:js_escape(Value).
 
 
 -define(IS_STRING(Term), (is_list(Term) andalso Term /= [] andalso is_integer(hd(Term)))).
 -define(IS_STRING(Term), (is_list(Term) andalso Term /= [] andalso is_integer(hd(Term)))).