question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RA.padStart, RA.padEnd?

See original GitHub issue

#391

JS already has String.prototype.padStart and String.prototype.padEnd, it’s only a matter of exposing a functional interface to them.

  1. If we used R.invoker for that, they’d have signature targetLength -> padString -> stringToPad -> paddedString. I feel like a better signature would be padString -> targetLength -> stringToPad -> paddedString.

  2. How would we name them?

    • padStart and padEnd?
    • leftPad and rightPad?
    • padLeft and padRight?

    My preferred choice would probably be padStart and padEnd, for consistency with JS.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:33 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
char0ncommented, Feb 25, 2018

Nope, we use methods from String.prototype if present. If not present we provide polyfill.

Ref https://github.com/char0n/ramda-adjunct/blob/8ae9b5fa961217101c70a4d25fcdf6367022d754/src/isFinite.js#L14

1reaction
wojpawlikcommented, Feb 24, 2018

I said, wrapStart and wrapEnd sound like R.concat, I said nothing about wrap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

String.prototype.padStart() - JavaScript - MDN Web Docs
The padStart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given ...
Read more >
padStart.js - Documentation
padStart.js · import padCharsStart from './padCharsStart'; · /** · * Pads string on the left side if it's shorter than length. · *...
Read more >
J065: String.padStart(), padEnd() - YouTube
Hi everyone, and welcome to another snore-fest of an edition of Boring JavaScript! Today, I tackle the String.padStart() and String.padEnd() methods.
Read more >
padStart and padEnd String Methods in JavaScript
padStart and padEnd are two new methods available on JavaScript strings. As their name implies, they allow for formatting a string by adding ......
Read more >
Features Of ES8 - Outsourced Technical Support | ServerAdminz
Two functions are using with string for padding padStart and padEnd.These functions will pad the start or the end of the given string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found