tastypie
Version:
Tastypie is a webservice API framework for Node.js based on Django's Tastypie Framework. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces
18 lines (12 loc) • 388 B
JavaScript
var toString = require('../lang/toString');
var repeat = require('./repeat');
/**
* Pad string with `char` if its' length is smaller than `minLen`
*/
function lpad(str, minLen, ch) {
str = toString(str);
ch = ch || ' ';
return (str.length < minLen) ?
repeat(ch, minLen - str.length) + str : str;
}
module.exports = lpad;