@@ -239,10 +239,15 @@ defmodule Base do
239239 @ doc """
240240 Decodes a base 64 encoded string into a binary string.
241241
242+ Accepts `ignore: :whitespace` option which will ignore all the
243+ whitespace characters in the input string.
244+
242245 ## Examples
243246
244247 iex> Base.decode64("Zm9vYmFy")
245248 {:ok, "foobar"}
249+ iex> Base.decode64("Zm9vYmFy\\ n", ignore: :whitespace)
250+ {:ok, "foobar"}
246251
247252 """
248253 @ spec decode64 ( binary ) :: { :ok , binary } | :error
@@ -256,13 +261,18 @@ defmodule Base do
256261 @ doc """
257262 Decodes a base 64 encoded string into a binary string.
258263
264+ Accepts `ignore: :whitespace` option which will ignore all the
265+ whitespace characters in the input string.
266+
259267 An `ArgumentError` exception is raised if the padding is incorrect or
260268 a non-alphabet character is present in the string.
261269
262270 ## Examples
263271
264272 iex> Base.decode64!("Zm9vYmFy")
265273 "foobar"
274+ iex> Base.decode64!("Zm9vYmFy\\ n", ignore: :whitespace)
275+ "foobar"
266276
267277 """
268278 @ spec decode64! ( binary ) :: binary
@@ -290,10 +300,15 @@ defmodule Base do
290300 Decodes a base 64 encoded string with URL and filename safe alphabet
291301 into a binary string.
292302
303+ Accepts `ignore: :whitespace` option which will ignore all the
304+ whitespace characters in the input string.
305+
293306 ## Examples
294307
295308 iex> Base.url_decode64("_3_-_A==")
296309 {:ok, <<255, 127, 254, 252>>}
310+ iex> Base.url_decode64("_3_-_A==\\ n", ignore: :whitespace)
311+ {:ok, <<255, 127, 254, 252>>}
297312
298313 """
299314 @ spec url_decode64 ( binary ) :: { :ok , binary } | :error
@@ -308,13 +323,18 @@ defmodule Base do
308323 Decodes a base 64 encoded string with URL and filename safe alphabet
309324 into a binary string.
310325
326+ Accepts `ignore: :whitespace` option which will ignore all the
327+ whitespace characters in the input string.
328+
311329 An `ArgumentError` exception is raised if the padding is incorrect or
312330 a non-alphabet character is present in the string.
313331
314332 ## Examples
315333
316334 iex> Base.url_decode64!("_3_-_A==")
317335 <<255, 127, 254, 252>>
336+ iex> Base.url_decode64!("_3_-_A==\\ n", ignore: :whitespace)
337+ <<255, 127, 254, 252>>
318338
319339 """
320340 @ spec url_decode64! ( binary ) :: binary
0 commit comments