File: padCenter.js

package info (click to toggle)
node-columnify 1.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 29,684 kB
  • sloc: makefile: 9
file content (18 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var test = require('tape')

var padCenter =  require('../utils').padCenter

test('pad string with spaces up to len (sides equal)', function(t) {
  t.plan(1)
  t.equal(padCenter('word', 10), '   word   ')
})

test('pad string with spaces up to len (sides not equal)', function(t) {
  t.plan(1)
  t.equal(padCenter('words', 10), '  words   ')
})

test('pad string with paddingChr of length >1, up to len', function(t) {
  t.plan(1)
  t.equal(padCenter('word', 10, ' .'), ' . word . ')
})