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.

Is your feature request related to a problem? Please describe. Removes leading specified characters from string.

Describe the solution you’d like

RA.trimCharsStart('_-', '-_-abc-_-'); //=> 'abc-_-'

Additional context

Function should be curried. Related to trimStart/trimEnd issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
char0ncommented, Nov 4, 2019

Take a look at lodash.trimStart. We need exactly the same behavior. In our case the first argument are the characters in form of string that are replacing the characters at the beginning of a value. So our arguments are

trimCharsStart(chars, value)

Now how should it work ? We decompose the value into list of characters called valueCharList with the following construct valueCharList = [...value]. We then iterate this list of characters and checking if the current character is contained within chars string. If yes, then we shift the valueCharList. We repeat iteration until there is match in chars. If there is not match we return valueCharList.join(''). And that should be the algorithm.

1reaction
M-ZubairAhmedcommented, Nov 1, 2019

@char0n can i take this

Read more comments on GitHub >

github_iconTop Results From Across the Web

trimCharsStart.js - Documentation
* Removes specified characters from the beginning of a string. *; * @func trimCharsStart; * @memberOf RA ...
Read more >
trimCharsStart.js | searchcode
searchcode is a free source code search engine. Code snippets and open source (free sofware) repositories are indexed and searchable.
Read more >
trimStart/trimEnd · Issue #808 · char0n/ramda-adjunct - GitHub
I've create another related function trimCharsStart and trimCharsEnd. All reactions.
Read more >
Alex (@js636f) / Twitter
The release contains one single community contributed function `trimCharsStart`. Read more in attached release article #javascript ...
Read more >
Index of /resources/responsive-static ... - The Northern Echo
Index of /resources/responsive-static/node_modules/@babel/traverse/node_modules/lodash/fp · Parent Directory · F.js · T.js · __.js · _baseConvert.js · _convertBrowser ...
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