You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2020/11/05 21:44:34 UTC
[incubator-annotator] 01/03: Remove unused read1() method
This is an automated email from the ASF dual-hosted git repository.
gerben pushed a commit to branch import-dom-seek
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit b1a13f996051a9d616ea9eefab165da6f6ff2999
Author: Gerben <ge...@treora.com>
AuthorDate: Thu Oct 29 17:11:08 2020 +0100
Remove unused read1() method
---
packages/dom/src/code-point-seeker.ts | 11 -----------
packages/dom/src/seek.ts | 12 ------------
2 files changed, 23 deletions(-)
diff --git a/packages/dom/src/code-point-seeker.ts b/packages/dom/src/code-point-seeker.ts
index ecd6ba9..9adc89c 100644
--- a/packages/dom/src/code-point-seeker.ts
+++ b/packages/dom/src/code-point-seeker.ts
@@ -41,17 +41,6 @@ class _CodePointSeeker implements Seeker<string[]> {
return this._readOrSeekTo(true, target, roundUp);
}
- read1(length?: number) {
- const chunk = this.read(1, true);
- if (length !== undefined && chunk.length > length) {
- // The chunk was larger than requested; walk back a little.
- this.seekBy(length - chunk.length);
- return chunk.slice(0, length);
- } else {
- return chunk;
- }
- }
-
private _readOrSeekTo(read: true, target: number, roundUp?: boolean): string[];
private _readOrSeekTo(read: false, target: number, roundUp?: boolean): void;
private _readOrSeekTo(read: boolean, target: number, roundUp: boolean = false): string[] | void {
diff --git a/packages/dom/src/seek.ts b/packages/dom/src/seek.ts
index 2bed6b5..67a7adc 100644
--- a/packages/dom/src/seek.ts
+++ b/packages/dom/src/seek.ts
@@ -37,7 +37,6 @@ export interface Seeker<T extends Iterable<any> = string> {
readonly position: number;
read(length?: number, roundUp?: boolean): T;
readTo(target: number, roundUp?: boolean): T;
- // read1(length?: number): T;
seekBy(length: number): void;
seekTo(target: number): void;
}
@@ -65,17 +64,6 @@ class _TextSeeker<TChunk extends Chunk<string>> implements Seeker<string> {
return this._readOrSeekTo(true, target, roundUp);
}
- read1(length?: number) {
- const chunk = this.read(1, true);
- if (length !== undefined && chunk.length > length) {
- // The chunk was larger than requested; walk back a little.
- this.seekBy(length - chunk.length);
- return chunk.substring(0, length);
- } else {
- return chunk;
- }
- }
-
seekBy(length: number) {
this.seekTo(this.position + length);
}