Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: withPad / pad / lrpad #100

Open
vorillaz opened this issue Oct 30, 2019 · 3 comments
Open

Feature: withPad / pad / lrpad #100

vorillaz opened this issue Oct 30, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@vorillaz
Copy link
Contributor

vorillaz commented Oct 30, 2019

Pads the input text to a new length.

  pad(); // => ''
  pad('Hello', 1); // => 'Hello'
  pad('Hello', 7); // => '  Hello  '
  pad('Hello', 7, '*'); // => '*Hello*'
  pad('Hello', 10, '*'); // => '**Hello***'
  pad('Hello', 10, '123'); // => '123Hello12'

Aliases

import pad from '@plexis/pad';
import {pad, lrpad} from 'plexis';
@vorillaz vorillaz added the enhancement New feature or request label Oct 30, 2019
@ositowang
Copy link

I think I could take this feature and create a pull request within this week.

@AngelGzS
Copy link
Contributor

AngelGzS commented Nov 6, 2019

I think I could take this feature and create a pull request within this week.

Go for it

@ositowang
Copy link

A quick question here. How many functions I should export here. one or two(pad and lrpad or pad only)?
And the last two cases described in the feature seems incompatible. Under what case should I pad left first?
Based on the second last example, seems the last case result should be "12hello123"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants