0.0.2 • Published 8 years ago
ts-left-pad v0.0.2
ts-left-pad
THE ONLY TYPE SAFE WAY1 TO PAD A STRING ON THE LEFT OF THE STRING
var theleft = require("ts-left-pad");
theleft("goat", 10)
// ' goat'
theleft("goat", 10, ".")
// '......goat'
INSTALLING
npm install ts-left-pad
NOTES
As it turns out, I think the ts compiler removes stuff that would handle type-checking at runtime, so coding defensively against the user at runtime might be a wiser choice.
1: Wanted a template project to play with typescript tooling: travis, tests, publishing for npm usage.