index.js 191 B

12345678910
  1. 'use strict';
  2. module.exports = string => {
  3. const match = string.match(/^[ \t]*(?=\S)/gm);
  4. if (!match) {
  5. return 0;
  6. }
  7. return match.reduce((r, a) => Math.min(r, a.length), Infinity);
  8. };