vlq

WebJar for vlq

Лицензия

Лицензия

MIT
Группа

Группа

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

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

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

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

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

vlq
WebJar for vlq
Ссылка на сайт

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

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

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

https://github.com/Rich-Harris/vlq

Скачать vlq

Имя Файла Размер
vlq-1.0.0.pom
vlq-1.0.0.jar 6 KB
vlq-1.0.0-sources.jar 22 bytes
vlq-1.0.0-javadoc.jar 22 bytes
Обзор

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

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

Зависимости

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

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

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

vlq.js

Convert integers to a Base64-encoded VLQ string, and vice versa. No dependencies, works in node.js or browsers, supports AMD.

Why would you want to do that?

Sourcemaps are the most likely use case. Mappings from original source to generated content are encoded as a sequence of VLQ strings.

What is a VLQ string?

A variable-length quantity is a compact way of encoding large integers in text (i.e. in situations where you can't transmit raw binary data). An integer represented as digits will always take up more space than the equivalent VLQ representation:

Integer VLQ
0 A
1 C
-1 D
123 2H
123456789 qxmvrH

Installation

npm install vlq

...or...

bower install vlq

...or grab the vlq.js file and include it with a <script src='vlq.js'> tag.

Usage

Encoding

vlq.encode accepts an integer, or an array of integers, and returns a string:

vlq.encode( 123 ); // '2H';
vlq.encode([ 123, 456, 789 ]); // '2HwcqxB'

Decoding

vlq.decode accepts a string and always returns an array:

vlq.decode( '2H' ); // [ 123 ]
vlq.decode( '2HwcqxB' ); // [ 123, 456, 789 ]

Limitations

Since JavaScript bitwise operators work on 32 bit integers, the maximum value this library can handle is 2^30 - 1, or 1073741823.

Using vlq.js with sourcemaps

See here for an example of using vlq.js with sourcemaps.

Credits

Adapted from murzwin.com/base64vlq.html by Alexander Pavlov.

License

MIT.

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

Версия
1.0.0
0.2.3
0.2.1