until-after

1.0.4 • Public • Published

until-after

API

operand::untilAfter(pattern)

Returns the trimmed string.

Looks for a pattern in a string and, if the pattern is found, crops the string after the first occurrence of the pattern, keeping the trailing remainder.

Designed for use with :: function bind syntax, as the this property should be the string to trim.

operand

String to trim.

pattern

String to look for and trim after.

Use Case

import {untilAfter} from 'from-after'

const filepath = '~/app/node_modules/foo/bar.js'

filepath::untilAfter('node_modules/')
// -> '~/app/node_modules/`

See Also

const text = 'goodbye cruel world'

text::fromBefore('cruel')  // 'cruel world'
text::fromAfter('cruel')   // ' world'
text::untilBefore('cruel') // 'goodbye '
text::untilAfter('cruel')  // 'goodbye cruel'

Colophon

Made by Sebastiaan Deckers in Singapore 🇸🇬

Readme

Keywords

Package Sidebar

Install

npm i until-after

Weekly Downloads

0

Version

1.0.4

License

ISC

Last publish

Collaborators

  • seb