Converts a tilde path to an absolute path.
String.prototype.replace()
with a regular expression and os.homedir()
to replace the ~
in the start of the path with the home directory.const untildify = str =>
str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`);
untildify('~/node'); // '/Users/aUser/node'
JavaScript, Node
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.
JavaScript, Node
Adds special characters to text to print in color in the console (combined with console.log()
).
JavaScript, Node
Decodes a string of data which has been encoded using base-64 encoding.