Skip to content

Commit b6ff3f2

Browse files
committed
center, ljust, rjust aliases for lrpad, lpad, rpad methods
1 parent 25f76e0 commit b6ff3f2

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

README.markdown

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ left/right-pad a string. Alias for `pad(str, length, padStr, 'both')`
270270
_.lrpad("1", 8, '0')
271271
-> "00001000";
272272

273+
**center** alias for **lrpad**
273274

275+
**ljust** alias for *lpad*
276+
277+
**rjust** alias for *rpad*
274278

275279
## Roadmap ##
276280

@@ -282,7 +286,7 @@ Any suggestions or bug reports are welcome. Just email me or more preferably ope
282286

283287
### 1.1.4 ###
284288

285-
* Added pad family methods
289+
* Added pad, lpad, rpad, lrpad methods and aliases center, ljust, rjust
286290
* Integration with Underscore 1.1.6
287291

288292
### 1.1.3 ###

dist/underscore.string.min.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/underscore.string.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,12 @@
278278

279279
// Aliases
280280

281-
_s.strip = _s.trim;
282-
_s.lstrip = _s.ltrim;
283-
_s.rstrip = _s.rtrim;
281+
_s.strip = _s.trim;
282+
_s.lstrip = _s.ltrim;
283+
_s.rstrip = _s.rtrim;
284+
_s.center = _s.lrpad
285+
_s.ljust = _s.lpad
286+
_s.rjust = _s.rpad
284287

285288
// CommonJS module is defined
286289
if (typeof window === 'undefined' && typeof module !== 'undefined') {

0 commit comments

Comments
 (0)