Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vlq

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vlq - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

4

CHANGELOG.md
# changelog
## 0.2.2
* Expose `pkg.module`, not `jsnext:main`
## 0.2.1

@@ -4,0 +8,0 @@

129

dist/vlq.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
factory((global.vlq = {}))
}(this, function (exports) { 'use strict';
(factory((global.vlq = global.vlq || {})));
}(this, (function (exports) { 'use strict';
exports.decode = decode;
exports.encode = encode;
var charToInteger = {};
var integerToChar = {};
var charToInteger = {};
var integerToChar = {};
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
charToInteger[ char ] = i;
integerToChar[ i ] = char;
});
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
charToInteger[ char ] = i;
integerToChar[ i ] = char;
});
function decode ( string ) {
var result = [];
var shift = 0;
var value = 0;
function decode ( string ) {
var result = [],
len = string.length,
i,
hasContinuationBit,
shift = 0,
value = 0,
integer,
shouldNegate;
for ( var i = 0; i < string.length; i += 1 ) {
var integer = charToInteger[ string[i] ];
for ( i = 0; i < len; i += 1 ) {
integer = charToInteger[ string[i] ];
if ( integer === undefined ) {
throw new Error( 'Invalid character (' + string[i] + ')' );
}
if ( integer === undefined ) {
throw new Error( 'Invalid character (' + string[i] + ')' );
}
var hasContinuationBit = integer & 32;
hasContinuationBit = integer & 32;
integer &= 31;
value += integer << shift;
integer &= 31;
value += integer << shift;
if ( hasContinuationBit ) {
shift += 5;
} else {
var shouldNegate = value & 1;
value >>= 1;
if ( hasContinuationBit ) {
shift += 5;
} else {
shouldNegate = value & 1;
value >>= 1;
result.push( shouldNegate ? -value : value );
result.push( shouldNegate ? -value : value );
// reset
value = shift = 0;
}
// reset
value = shift = 0;
}
return result;
}
function encode ( value ) {
var result, i;
return result;
}
if ( typeof value === 'number' ) {
result = encodeInteger( value );
} else {
result = '';
for ( i = 0; i < value.length; i += 1 ) {
result += encodeInteger( value[i] );
}
function encode ( value ) {
var result;
if ( typeof value === 'number' ) {
result = encodeInteger( value );
} else {
result = '';
for ( var i = 0; i < value.length; i += 1 ) {
result += encodeInteger( value[i] );
}
}
return result;
return result;
}
function encodeInteger ( num ) {
var result = '';
if ( num < 0 ) {
num = ( -num << 1 ) | 1;
} else {
num <<= 1;
}
function encodeInteger ( num ) {
var result = '', clamped;
do {
var clamped = num & 31;
num >>= 5;
if ( num < 0 ) {
num = ( -num << 1 ) | 1;
} else {
num <<= 1;
if ( num > 0 ) {
clamped |= 32;
}
do {
clamped = num & 31;
num >>= 5;
result += integerToChar[ clamped ];
} while ( num > 0 );
if ( num > 0 ) {
clamped |= 32;
}
return result;
}
result += integerToChar[ clamped ];
} while ( num > 0 );
exports.decode = decode;
exports.encode = encode;
return result;
}
Object.defineProperty(exports, '__esModule', { value: true });
}));
})));

@@ -7,5 +7,5 @@ {

"license": "MIT",
"version": "0.2.1",
"version": "0.2.2",
"main": "dist/vlq.js",
"jsnext:main": "src/vlq.js",
"module": "src/vlq.js",
"files": [

@@ -17,11 +17,12 @@ "README.md",

"devDependencies": {
"esperanto": "^0.6.8",
"jshint": "^2.6.0"
"eslint": "^3.19.0",
"rollup": "^0.41.6"
},
"scripts": {
"build": "esperanto -i src/vlq.js -o dist/vlq.js -t umd -n vlq -s",
"lint": "jshint src",
"test": "node test",
"prepublish": "npm run lint; npm run build; npm test"
"build": "rollup src/vlq.js -n vlq -f umd > dist/vlq.js",
"lint": "eslint src",
"test": "node test",
"pretest": "npm run build",
"prepublish": "npm test"
}
}

@@ -10,13 +10,8 @@ var charToInteger = {};

export function decode ( string ) {
var result = [],
len = string.length,
i,
hasContinuationBit,
shift = 0,
value = 0,
integer,
shouldNegate;
var result = [];
var shift = 0;
var value = 0;
for ( i = 0; i < len; i += 1 ) {
integer = charToInteger[ string[i] ];
for ( var i = 0; i < string.length; i += 1 ) {
var integer = charToInteger[ string[i] ];

@@ -27,3 +22,3 @@ if ( integer === undefined ) {

hasContinuationBit = integer & 32;
var hasContinuationBit = integer & 32;

@@ -36,3 +31,3 @@ integer &= 31;

} else {
shouldNegate = value & 1;
var shouldNegate = value & 1;
value >>= 1;

@@ -51,3 +46,3 @@

export function encode ( value ) {
var result, i;
var result;

@@ -58,3 +53,3 @@ if ( typeof value === 'number' ) {

result = '';
for ( i = 0; i < value.length; i += 1 ) {
for ( var i = 0; i < value.length; i += 1 ) {
result += encodeInteger( value[i] );

@@ -68,3 +63,3 @@ }

function encodeInteger ( num ) {
var result = '', clamped;
var result = '';

@@ -78,3 +73,3 @@ if ( num < 0 ) {

do {
clamped = num & 31;
var clamped = num & 31;
num >>= 5;

@@ -81,0 +76,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc