# until-before

> Keep a string up to a pattern, trim the trailing remainder

Latest version **1.0.3** (published 2017-05-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install until-before
pnpm add until-before
yarn add until-before
bun add until-before
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2017-05-02 |
| First published | 2016-11-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sebastiaan Deckers |
| Maintainers | seb |
| Keywords | trim, string |

## Links

- npm: https://www.npmjs.com/package/until-before
- Repository: https://gitlab.com/sebdeckers/until-before
- Homepage: https://gitlab.com/sebdeckers/until-before#README
- Issues: https://gitlab.com/sebdeckers/until-before/issues
- npm.io page: https://npm.io/package/until-before

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2017-05-02
- 1.0.2 — 2017-04-21
- 1.0.1 — 2017-04-21
- 1.0.0 — 2016-11-16

## README

# until-before

## API

### `operand::untilBefore(pattern)`

Returns the trimmed string.

Looks for a pattern in a string and, if the pattern is found, crops the string before the first occurrence of the pattern, removing 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 before.

## Use Case

```js
import {untilBefore} from 'until-before'

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

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

## See Also

- [from-before](https://www.npmjs.com/package/from-before) ⟼
- [from-after](https://www.npmjs.com/package/from-after) ⇤
- [until-before](https://www.npmjs.com/package/until-before) ⇥
- [until-after](https://www.npmjs.com/package/until-after) ⟻

```js
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 🇸🇬

---
_Source: https://npm.io/package/until-before · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
