pad-mid
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

pad-mid

NPM version NPM monthly download

Pads each middle character of a string

Installation

npm install pad-mid

Example:

import {padMid} from 'pad-mid';

expect(padMid('foobar')).toEqual('f o o b a r');

expect(padMid('foobar', 2)).toEqual('f  o  o  b  a  r');

expect(padMid('foobar', 2, '*')).toEqual('f**o**o**b**a**r');

expect(padMid('foobar', 2, '**')).toEqual('f****o****o****b****a****r');

// prettier-ignore
expect(padMid(`i
love
you`, 1, '*')).toEqual(`i
l*o*v*e
y*o*u`);

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i pad-mid

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

3.61 kB

Total Files

7

Last publish

Collaborators

  • nghiepit