From f42dcbd7e2393511819671292726b6bc9256cf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= Date: Fri, 26 Jan 2018 10:37:01 +0100 Subject: [PATCH] Update escape option to be more consistent in naming --- lib/encode.ex | 5 ++++- lib/jason.ex | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/encode.ex b/lib/encode.ex index d675e69..c20ed67 100644 --- a/lib/encode.ex +++ b/lib/encode.ex @@ -49,9 +49,12 @@ defmodule Jason.Encode do defp escape_function(%{escape: escape}) do case escape do :json -> &escape_json/4 - :unicode -> &escape_unicode/4 :html_safe -> &escape_html/4 + :unicode_safe -> &escape_unicode/4 + :javascript_safe -> &escape_javascript/4 + # Keep for compatibility with Poison :javascript -> &escape_javascript/4 + :unicode -> &escape_unicode/4 end end diff --git a/lib/jason.ex b/lib/jason.ex index bb59201..ac76e75 100644 --- a/lib/jason.ex +++ b/lib/jason.ex @@ -3,7 +3,7 @@ defmodule Jason do A blazing fast JSON parser and generator in pure Elixir. """ - @type escape :: :json | :unicode | :html | :javascript + @type escape :: :json | :unicode_safe | :html_safe | :javascript_safe @type maps :: :naive | :strict @type encode_opt :: {:escape, escape} | {:maps, maps}