UNPKG

xml-lite

Version:

maintaining xml in pure javascript (IN BOTH NODE.JS & BROWSERS)

15 lines (14 loc) 270 B
'use strict'; /** * left-pad module * @module left-pad * @see module:index */ module.exports = (str, total, spacer) => { spacer = spacer || ' '; let result = str.toString(); while (result.length < total) { result = spacer + result; } return result; };