UNPKG

particle-cli

Version:

Simple Node commandline application for working with your Particle devices and using the Particle Cloud

11 lines (8 loc) 248 B
module.exports = function unindent(string) { const match = string.match(/\n(\s*)/m); if (!match) { return string; } const re = new RegExp(`^${match[1]}`, 'gm'); return string.replace(re, '').replace(/^\n/, '').replace(/\n[ \t]*$/, ''); };