Skip to main content
Home
This release is 6 versions behind 0.11.1 — the latest version of @eu-ge-ne/text-buf. Jump to latest

Built and signed on GitHub Actions

piece table data structure implemented using red-black tree.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a week ago (0.9.0)
class TextBuf

piece table data structure implemented using red-black tree.

Constructors

new
TextBuf(text?: string)

Creates instances of TextBuf interpreting text characters as UTF-16 code units. Visit MDN for more details. Accepts optional initial text.

Properties

readonly
count: number

Returns number of characters in the buffer.

Returns number of lines in the buffer.

Methods

delete(
start: Position,
end?: Position,
): void

Removes characters in the buffer's section, specified by start (inclusive) and end (exclusive) positions.

read(
start: Position,
end?: Position,
): string

Returns text in the buffer's section, specified by start (inclusive) and end (exclusive) positions.

write(
pos: Position,
text: string,
): void

Inserts text into the buffer at the specified position.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";
or

Import directly with a jsr specifier

import { TextBuf } from "jsr:@eu-ge-ne/text-buf";

Add Package

pnpm i jsr:@eu-ge-ne/text-buf
or (using pnpm 10.8 or older)
pnpm dlx jsr add @eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";

Add Package

yarn add jsr:@eu-ge-ne/text-buf
or (using Yarn 4.8 or older)
yarn dlx jsr add @eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";

Add Package

vlt install jsr:@eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";

Add Package

npx jsr add @eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";

Add Package

bunx jsr add @eu-ge-ne/text-buf

Import symbol

import { TextBuf } from "@eu-ge-ne/text-buf";