UNPKG

particle-cli

Version:

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

12 lines (9 loc) 262 B
'use strict'; 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]*$/, ''); };