# sed-lite

> `sed` compiler for JavaScript

Latest version **1.4.1** (published 2026-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install sed-lite
pnpm add sed-lite
yarn add sed-lite
bun add sed-lite
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2026-09-03 |
| First published | 2020-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.8.0 |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 9 |
| Author | Yusuke Kawasaki |
| Maintainers | kawanet |
| Keywords | replace, sed |

## Links

- npm: https://www.npmjs.com/package/sed-lite
- Repository: https://github.com/kawanet/sed-lite
- Homepage: https://github.com/kawanet/sed-lite#readme
- Issues: https://github.com/kawanet/sed-lite/issues
- npm.io page: https://npm.io/package/sed-lite

## Recent versions

- 1.4.1 (latest) — 2026-09-03
- 1.4.0 — 2026-09-02
- 1.3.0 — 2026-08-22
- 1.2.3 — 2026-08-18
- 1.2.2 — 2026-06-15
- 1.2.1 — 2026-05-06
- 1.1.0 — 2024-12-15
- 1.0.0 — 2022-11-07
- 0.8.4 — 2021-04-28
- 0.8.3 — 2021-04-28
- 0.8.2 — 2020-05-18
- 0.8.1 — 2020-05-17
- 0.8.0 — 2020-05-16

## README

# sed-lite

[![npm](https://img.shields.io/npm/v/sed-lite.svg)](https://www.npmjs.com/package/sed-lite)
[![Node.js CI](https://github.com/kawanet/sed-lite/actions/workflows/nodejs.yml/badge.svg?branch=main)](https://github.com/kawanet/sed-lite/actions/)
[![gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/sed-lite/dist/sed-lite.min.js?compression=gzip)](https://cdn.jsdelivr.net/npm/sed-lite/dist/sed-lite.min.js)

Compile `sed`-style substitution definitions into JavaScript replacer functions.

## SYNOPSIS

```js
import {sed} from "sed-lite";

const foo = sed("s/foo/FOO/"); // str => str.replace(/foo/, "FOO")

foo("Hello, foo!"); // Hello, FOO!

const bar = sed("s/<(\\/?h[1-6]+)>/[$1]/g"); // str => str.replace(/(\/?h[1-6]+)>/g, "[$1]")

bar("<h1>bar</h1>"); // [h1]bar[/h1]

const buz = sed("s#foo#bar#; s#bar#buz#"); // str => str.replace(/foo/, "bar").replace(/bar/, "buz")

buz("Hello, foo!"); // Hello, buz!
```

See TypeScript declaration
[sed-lite.d.ts](https://github.com/kawanet/sed-lite/blob/main/types/sed-lite.d.ts)
for more detail.

## SEE ALSO

- https://github.com/kawanet/sed-lite
- https://www.npmjs.com/package/sed-lite
- https://www.npmjs.com/package/express-sed
- https://www.npmjs.com/package/browserify-sed

## LICENSE

The MIT License (MIT)

Copyright (c) 2020-2026 Yusuke Kawasaki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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