rope-sequence

WebJar for rope-sequence

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

rope-sequence
Последняя версия

Последняя версия

1.3.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

rope-sequence
WebJar for rope-sequence
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/marijnh/rope-sequence

Скачать rope-sequence

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/rope-sequence/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>rope-sequence</artifactId>
    <version>1.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/rope-sequence/
implementation 'org.webjars.npm:rope-sequence:1.3.2'
// https://jarcasting.com/artifacts/org.webjars.npm/rope-sequence/
implementation ("org.webjars.npm:rope-sequence:1.3.2")
'org.webjars.npm:rope-sequence:jar:1.3.2'
<dependency org="org.webjars.npm" name="rope-sequence" rev="1.3.2">
  <artifact name="rope-sequence" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='rope-sequence', version='1.3.2')
)
libraryDependencies += "org.webjars.npm" % "rope-sequence" % "1.3.2"
[org.webjars.npm/rope-sequence "1.3.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

rope-sequence

This module implements a single data type, RopeSequence, which is a persistent sequence type implemented as a loosely-balanced rope. It supports appending, prepending, and slicing without doing a full copy. Random access is somewhat more expensive than in an array (logarithmic, with some overhead), but should still be relatively fast.

Licensed under the MIT license.

class RopeSequence<T>

static from(?union<[T], RopeSequence<T>>) → RopeSequence<T>

Create a rope representing the given array, or return the rope itself if a rope was given.

static empty: RopeSequence<T>

The empty rope.

length: number

The length of the rope.

append(union<[T], RopeSequence<T>>) → RopeSequence<T>

Append an array or other rope to this one, returning a new rope.

prepend(union<[T], RopeSequence<T>>) → RopeSequence<T>

Prepend an array or other rope to this one, returning a new rope.

slice(from: ?number = 0, to: ?number = this.length) → RopeSequence<T>

Create a rope repesenting a sub-sequence of this rope.

get(index: number) → T

Retrieve the element at the given position from this rope.

forEach(f: fn(element: T, index: number) → ?bool, from: ?number, to: ?number)

Call the given function for each element between the given indices. This tends to be more efficient than looping over the indices and calling get, because it doesn't have to descend the tree for every element.

to may be less then from, in which case the iteration will happen in reverse (starting at index from - 1, down to index to.

The iteration function may return false to abort iteration early.

map(f: fn(element: T, index: number) → U, from: ?number, to: ?number) → [U]

Map the given functions over the elements of the rope, producing a flat array.

flatten() → [T]

Return the content of this rope as an array.

Версии библиотеки

Версия
1.3.2