From db202497a73bdb26f47e21bf2158fce76a4565a5 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Thu, 4 Oct 2018 13:46:53 +0000 Subject: [PATCH] Travis build: 594 --- README.md | 2 +- docs/node.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebe62a3d4..7f35f470d 100644 --- a/README.md +++ b/README.md @@ -6179,7 +6179,7 @@ Creates a base-64 encoded ASCII string from a String object in which each charac Create a `Buffer` for the given string with binary encoding and use `Buffer.toString('base64')` to return the encoded string. ```js -const btoa = str => new Buffer.from(str, 'binary').toString('base64'); +const btoa = str => Buffer.from(str, 'binary').toString('base64'); ```
diff --git a/docs/node.html b/docs/node.html index 7f0761626..0372482f0 100644 --- a/docs/node.html +++ b/docs/node.html @@ -93,7 +93,7 @@ }, false); }

logo 30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.



Node

atob

Decodes a string of data which has been encoded using base-64 encoding.

Create a Buffer for the given string with base-64 encoding and use Buffer.toString('binary') to return the decoded string.

const atob = str => Buffer.from(str, 'base64').toString('binary');
 
atob('Zm9vYmFy'); // 'foobar'
-

btoa

Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.

Create a Buffer for the given string with binary encoding and use Buffer.toString('base64') to return the encoded string.

const btoa = str => new Buffer.from(str, 'binary').toString('base64');
+

btoa

Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.

Create a Buffer for the given string with binary encoding and use Buffer.toString('base64') to return the encoded string.

const btoa = str => Buffer.from(str, 'binary').toString('base64');
 
btoa('foobar'); // 'Zm9vYmFy'
 

colorize

Add special characters to text to print in color in the console (combined with console.log()).

Use template literals and special characters to add the appropriate color code to the string output. For background colors, add a special character that resets the background color at the end of the string.

const colorize = (...args) => ({
   black: `\x1b[30m${args.join(' ')}`,